From: Hungyu Lin <dennylin0707@gmail.com>
To: ast@kernel.org, bpf@vger.kernel.org
Cc: daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com,
ihor.solodrai@linux.dev, iii@linux.ibm.com, bjorn@kernel.org,
pulehui@huawei.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH bpf-next] selftests/bpf: Account for zero extensions in patch list expectations
Date: Tue, 3 Nov 2026 21:53:09 +0000 [thread overview]
Message-ID: <20261103215309.19950-1-dennylin0707@gmail.com> (raw)
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
next reply other threads:[~2026-11-03 21:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 21:53 Hungyu Lin [this message]
2026-11-03 22:30 ` bot+bpf-ci
2026-11-04 0:44 ` Alexei Starovoitov
2026-11-04 0:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103215309.19950-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=iii@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pulehui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®