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 --- .../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