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

Copy the pointer directly into the first argument register and update the
special calling convention documentation.

Fixes: b8efa810c1db ("s390/bpf: Add s390 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/s390/net/bpf_jit_comp.c       | 6 +++---
 arch/s390/net/bpf_timed_may_goto.S | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index c46872b071ce..4098c3377c21 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -1872,9 +1872,9 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, 
struct bpf_prog *fp,
                if ((void *)func == arch_bpf_timed_may_goto) {
                        /*
                         * arch_bpf_timed_may_goto() has a special ABI: the
-                        * parameters are in BPF_REG_AX and BPF_REG_10; the
-                        * return value is in BPF_REG_AX; and all GPRs except
-                        * REG_W0, REG_W1, and BPF_REG_AX are callee-saved.
+                        * parameter and return value are in BPF_REG_AX; all
+                        * GPRs except REG_W0, REG_W1, and BPF_REG_AX are
+                        * callee-saved.
                         */
 
                        /* brasl %r0,func */
diff --git a/arch/s390/net/bpf_timed_may_goto.S 
b/arch/s390/net/bpf_timed_may_goto.S
index 06f567a460d7..e34c99982c4a 100644
--- a/arch/s390/net/bpf_timed_may_goto.S
+++ b/arch/s390/net/bpf_timed_may_goto.S
@@ -21,9 +21,9 @@
 
 SYM_FUNC_START(arch_bpf_timed_may_goto)
        /*
-        * This function has a special ABI: the parameters are in %r12 and
-        * %r13; the return value is in %r12; all GPRs except %r0, %r1, and
-        * %r12 are callee-saved; and the return address is in %r0.
+        * This function has a special ABI: the parameter and return value are
+        * in %r12; all GPRs except %r0, %r1, and %r12 are callee-saved; and
+        * the return address is in %r0.
         */
        stmg %r2,%r5,FRAME_OFF+R2_OFF(%r15)
        stg %r14,FRAME_OFF+R14_OFF(%r15)
@@ -33,7 +33,7 @@ SYM_FUNC_START(arch_bpf_timed_may_goto)
        lay %r15,-FRAME_SIZE(%r15)
        stg %r1,__SF_BACKCHAIN(%r15)
 
-       lay %r2,0(%r12,%r13)
+       lgr %r2,%r12
        brasl %r14,bpf_check_timed_may_goto
        lgr %r12,%r2
 
-- 
2.43.0

Reply via email to