The timed may_goto fixup now passes the resolved counter pointer through
BPF_REG_AX instead of a stack offset.

Copy the pointer directly into the first argument register rather than
adding it to the BPF frame pointer again.

Fixes: b55b6b9ad76c ("powerpc64/bpf: Add powerpc64 JIT support for timed 
may_goto")
Reported-by: Jeremy Jean <[email protected]>
Link: 
https://lore.kernel.org/all/[email protected]/
Assisted-by: Copilot:gpt-5.6-sol
Signed-off-by: Siddharth Chintamaneni <[email protected]>
---
 arch/powerpc/net/bpf_timed_may_goto.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/net/bpf_timed_may_goto.S 
b/arch/powerpc/net/bpf_timed_may_goto.S
index 84ecf6fa7f5d..d88825dd34fe 100644
--- a/arch/powerpc/net/bpf_timed_may_goto.S
+++ b/arch/powerpc/net/bpf_timed_may_goto.S
@@ -8,7 +8,7 @@
  * arch_bpf_timed_may_goto() trampoline for powerpc64
  *
  * Custom BPF convention (verifier/JIT):
- *     - input:  stack offset in BPF_REG_AX (r12)
+ *     - input:  count and timestamp pointer in BPF_REG_AX (r12)
  *     - output: updated count in BPF_REG_AX (r12)
  *
  * Call bpf_check_timed_may_goto(ptr) with normal powerpc64 ABI:
@@ -32,10 +32,10 @@ SYM_FUNC_START(arch_bpf_timed_may_goto)
        std     r8, 72(r1)
 
        /*
-        * r3 = BPF_REG_FP + BPF_REG_AX
-        * BPF_REG_FP is r31; BPF_REG_AX is r12 (stack offset in bytes).
+        * BPF_REG_AX (r12) contains the count and timestamp pointer; pass it as
+        * the first argument in r3.
         */
-       add     r3, r31, r12
+       mr      r3, r12
        bl      CFUNC(bpf_check_timed_may_goto)
 
        /* Put return value back into AX */
-- 
2.43.0

Reply via email to