mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Account for zero extensions in patch list expectations
@ 2026-11-03 21:53 Hungyu Lin
  2026-11-03 22:30 ` bot+bpf-ci
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hungyu Lin @ 2026-11-03 21:53 UTC (permalink / raw)
  To: ast, bpf
  Cc: daniel, andrii, eddyz87, ihor.solodrai, iii, bjorn, pulehui,
	linux-kselftest, linux-kernel, Hungyu Lin

patch_list_insert_in_front() checks the translated instructions around
the call of an inlined bpf_loop() and its callback. On s390, the verifier
adds zero extensions after the two 32-bit register writes in the loop.
The call is therefore at instruction 25 rather than 23, and the later
instructions checked by the test are also shifted by two. The test
fails despite the call and jump offsets being correct.

Use the corresponding instruction indices on s390 and RISC-V, whose
JITs request explicit zero extensions. Keep the original expectations
for the other enabled architectures and retain all branch offset and
callback entry checks.

Fixes: 57fae4059380 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.4-rc1")
Link: https://github.com/kernel-patches/bpf/actions/runs/41696128762/job/126138168160
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 .../selftests/bpf/progs/verifier_patch_list.c  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/testing/selftests/bpf/progs/verifier_patch_list.c b/tools/testing/selftests/bpf/progs/verifier_patch_list.c
index 581b75b7b5c5..a9ad1dc56c3a 100644
--- a/tools/testing/selftests/bpf/progs/verifier_patch_list.c
+++ b/tools/testing/selftests/bpf/progs/verifier_patch_list.c
@@ -298,6 +298,23 @@ __arch_arm64
 __arch_riscv64
 __arch_loongarch
 __success
+/* The verifier adds two zero extensions for these JITs. */
+#if defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_riscv)
+__xlated("25: call pc+7")
+__xlated("...")
+__xlated("32: exit")
+__xlated("33: r0 = ")
+__xlated("35: r0 = &(void __percpu *)(r0)")
+__xlated("36: r0 = *(u64 *)(r0 +0)")
+__xlated("37: if r0 != 0x0 goto pc+2")
+__xlated("38: r0 = 1")
+__xlated("39: exit")
+__xlated("40: r1 += -1")
+__xlated("...")
+__xlated("51: if r1 != 0x0 goto pc-12")
+__xlated("52: r0 = 0")
+__xlated("53: exit")
+#else
 __xlated("23: call pc+7")
 __xlated("...")
 __xlated("30: exit")
@@ -312,6 +329,7 @@ __xlated("...")
 __xlated("49: if r1 != 0x0 goto pc-12")
 __xlated("50: r0 = 0")
 __xlated("51: exit")
+#endif
 __naked void patch_list_insert_in_front(void)
 {
 	asm volatile (

base-commit: d4bf9e34e299e45af8da2b0457b0ac3efbd7ae8d
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-04  0:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 21:53 [PATCH bpf-next] selftests/bpf: Account for zero extensions in patch list expectations Hungyu Lin
2026-11-03 22:30 ` bot+bpf-ci
2026-11-04  0:44 ` Alexei Starovoitov
2026-11-04  0:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®