* [PATCH bpf-next v2 0/2] selftests/bpf: Handle some unexpected failures
@ 2026-11-09 4:12 Tiezhu Yang
2026-11-09 4:12 ` [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported Tiezhu Yang
2026-11-09 4:12 ` [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf Tiezhu Yang
0 siblings, 2 replies; 7+ messages in thread
From: Tiezhu Yang @ 2026-11-09 4:12 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi
Cc: bpf, loongarch, linux-kernel
v2:
- Use libbpf_probe_bpf_map_type() in prog_tests instead of
handling EOPNOTSUPP globally in test_loader.
- Fix unaligned access at the source by applying a bitmask
'off &= ~1' instead of skipping these tests entirely.
- Modify the patch subjects and update the commit messages.
Tiezhu Yang (2):
selftests/bpf: Skip jit_insns_arena tests if not supported
selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf
tools/testing/selftests/bpf/prog_tests/jit_insns.c | 9 ++++++++-
tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c | 1 +
tools/testing/selftests/bpf/progs/test_pkt_access.c | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)
--
2.42.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported
2026-11-09 4:12 [PATCH bpf-next v2 0/2] selftests/bpf: Handle some unexpected failures Tiezhu Yang
@ 2026-11-09 4:12 ` Tiezhu Yang
2026-11-09 4:25 ` sashiko-bot
2026-11-09 4:12 ` [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf Tiezhu Yang
1 sibling, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2026-11-09 4:12 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi
Cc: bpf, loongarch, linux-kernel
When loading a BPF skeleton program via test_loader, certain test cases
such as jit_insns/cast_to_user may fail if the underlying hardware lacks
specific execution extensions required by newer features like BPF Arena.
Use libbpf_probe_bpf_map_type() in prog_tests/jit_insns.c to explicitly
check for BPF_MAP_TYPE_ARENA support before loading the jit_insns_arena
test skeleton. If the JIT backend or hardware does not support Arena,
cleanly report the subtest status as SKIPPED via test__skip().
This prevents false-alarm test failures on unsupported hardware while
preserving the core verification coverage for the rest of the standard
JIT instruction tests (such as alu_imm, alu_reg).
Before:
$ sudo ./test_progs -a jit_insns/cast_to_user
...
libbpf: map 'arena': failed to create: -EOPNOTSUPP
run_subtest:FAIL:unexpected_load_failure unexpected error: -95 (errno 95)
...
Summary: 0/0 PASSED, 0 SKIPPED, 1/1 FAILED
After:
$ sudo ./test_progs -a jit_insns/cast_to_user
...
Summary: 1/0 PASSED, 1 SKIPPED, 0/0 FAILED
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/testing/selftests/bpf/prog_tests/jit_insns.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/jit_insns.c b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
index 0aaab23a2eef..e8a0e5ec2d6b 100644
--- a/tools/testing/selftests/bpf/prog_tests/jit_insns.c
+++ b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
@@ -3688,7 +3688,14 @@ static void test_tail_call(void)
void test_jit_insns(void)
{
- RUN_TESTS(jit_insns_arena);
+ if (libbpf_probe_bpf_map_type(BPF_MAP_TYPE_ARENA, NULL)) {
+ RUN_TESTS(jit_insns_arena);
+ } else {
+ if (test__start_subtest("arena_zero_off"))
+ test__skip();
+ if (test__start_subtest("cast_to_user"))
+ test__skip();
+ }
if (test__start_subtest("alu_imm"))
test_alu_imm();
if (test__start_subtest("alu_reg"))
--
2.42.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf
2026-11-09 4:12 [PATCH bpf-next v2 0/2] selftests/bpf: Handle some unexpected failures Tiezhu Yang
2026-11-09 4:12 ` [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported Tiezhu Yang
@ 2026-11-09 4:12 ` Tiezhu Yang
2026-11-09 4:17 ` sashiko-bot
1 sibling, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2026-11-09 4:12 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi
Cc: bpf, loongarch, linux-kernel
When executing "./test_progs -t fexit_bpf2bpf", there are 5 subtest
failures on platforms where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
is not set, because these platforms lack hardware unaligned access
support:
; tcp->check++; @ test_pkt_access.c:98
226: (69) r1 = *(u16 *)(r2 +16)
misaligned packet access off 2+(0x0; 0x3f)+16 size 2
...
libbpf: prog 'test_pkt_access': failed to load: -EACCES
libbpf: failed to load object './test_pkt_access.bpf.o'
Instead of skipping these tests entirely, fix this at the source by
applying a bitmask 'off &= ~1' right after the initial range check.
This explicitly communicates the 2-byte alignment state to pass the
verifier and run the full fexit_bpf2bpf test matrix.
Before:
$ sudo ./test_progs -t fexit_bpf2bpf | tail -1
Summary: 0/10 PASSED, 1 SKIPPED, 1/5 FAILED
After:
$ sudo ./test_progs -t fexit_bpf2bpf | tail -1
Summary: 1/15 PASSED, 1 SKIPPED, 0/0 FAILED
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c | 1 +
tools/testing/selftests/bpf/progs/test_pkt_access.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c b/tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c
index f4bbf87b82dd..ed06345825e2 100644
--- a/tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c
+++ b/tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c
@@ -173,6 +173,7 @@ int new_test_pkt_write_access_subprog(struct __sk_buff *skb, __u32 off)
if (off > sizeof(struct ethhdr) + sizeof(struct ipv6hdr))
return -1;
+ off &= ~1;
tcp = data + off;
if (tcp + 1 > data_end)
return -1;
diff --git a/tools/testing/selftests/bpf/progs/test_pkt_access.c b/tools/testing/selftests/bpf/progs/test_pkt_access.c
index bce7173152c6..21f28a762d60 100644
--- a/tools/testing/selftests/bpf/progs/test_pkt_access.c
+++ b/tools/testing/selftests/bpf/progs/test_pkt_access.c
@@ -91,6 +91,7 @@ int test_pkt_write_access_subprog(struct __sk_buff *skb, __u32 off)
if (off > sizeof(struct ethhdr) + sizeof(struct ipv6hdr))
return -1;
+ off &= ~1;
tcp = data + off;
if (tcp + 1 > data_end)
return -1;
--
2.42.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf
2026-11-09 4:12 ` [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf Tiezhu Yang
@ 2026-11-09 4:17 ` sashiko-bot
2026-11-09 6:11 ` Tiezhu Yang
0 siblings, 1 reply; 7+ messages in thread
From: sashiko-bot @ 2026-11-09 4:17 UTC (permalink / raw)
To: Tiezhu Yang; +Cc: bpf
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: missing Fixes trailer for commit 6dc03dc71387
--
commit 507288d3c1afad0bf83be8f5f5a571a1da547ccc
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
> selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf
>
> When executing "./test_progs -t fexit_bpf2bpf", there are 5 subtest
> failures on platforms where CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
> is not set, because these platforms lack hardware unaligned access
> support:
>
> ; tcp->check++; @ test_pkt_access.c:98
> 226: (69) r1 = *(u16 *)(r2 +16)
> misaligned packet access off 2+(0x0; 0x3f)+16 size 2
> ...
> libbpf: prog 'test_pkt_access': failed to load: -EACCES
> libbpf: failed to load object './test_pkt_access.bpf.o'
>
> Instead of skipping these tests entirely, fix this at the source by
> applying a bitmask 'off &= ~1' right after the initial range check.
> This explicitly communicates the 2-byte alignment state to pass the
> verifier and run the full fexit_bpf2bpf test matrix.
>
> Before:
> $ sudo ./test_progs -t fexit_bpf2bpf | tail -1
> Summary: 0/10 PASSED, 1 SKIPPED, 1/5 FAILED
>
> After:
> $ sudo ./test_progs -t fexit_bpf2bpf | tail -1
> Summary: 1/15 PASSED, 1 SKIPPED, 0/0 FAILED
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
[Severity: Low]
This fixes the unaligned packet offset in test_pkt_write_access_subprog()
and new_test_pkt_write_access_subprog(). Should this include:
Fixes: 6dc03dc71387 ("selftests/bpf: Add test for freplace program with write access")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109041207.15221-1-yangtiezhu@loongson.cn?part=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported
2026-11-09 4:12 ` [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported Tiezhu Yang
@ 2026-11-09 4:25 ` sashiko-bot
2026-11-09 6:10 ` Tiezhu Yang
0 siblings, 1 reply; 7+ messages in thread
From: sashiko-bot @ 2026-11-09 4:25 UTC (permalink / raw)
To: Tiezhu Yang; +Cc: bpf
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: incomplete jit_insns_arena skip list in
test_jit_insns()
--
commit 5301df7df06ac60c33f099fbdfa02a082cfa0c99
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
selftests/bpf: Skip jit_insns_arena tests if not supported
This commit probes for BPF_MAP_TYPE_ARENA support in test_jit_insns() and
skips the jit_insns_arena subtests when arena maps are not supported.
> diff --git a/tools/testing/selftests/bpf/prog_tests/jit_insns.c b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
> index 0aaab23a2eef8..e8a0e5ec2d6bf 100644
> --- a/tools/testing/selftests/bpf/prog_tests/jit_insns.c
> +++ b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
> @@ -3688,7 +3688,14 @@ static void test_tail_call(void)
>
> void test_jit_insns(void)
> {
> - RUN_TESTS(jit_insns_arena);
> + if (libbpf_probe_bpf_map_type(BPF_MAP_TYPE_ARENA, NULL)) {
> + RUN_TESTS(jit_insns_arena);
> + } else {
> + if (test__start_subtest("arena_zero_off"))
> + test__skip();
> + if (test__start_subtest("cast_to_user"))
> + test__skip();
> + }
[Severity: Low]
Does this else branch miss the remaining subtests in jit_insns_arena?
Commit a9fee553d3db ("selftests/bpf: Extend the JIT instruction tests for
arm64 encodings") added arena_offsets (built on all architectures) as well as
arena_offsets_ldsx, arena_offsets_atomics, and arena_acq_rel to
tools/testing/selftests/bpf/progs/jit_insns_arena.c. When BPF_MAP_TYPE_ARENA
is unsupported, those subtests are silently omitted rather than registered and
marked skipped, so targeted runs such as ./test_progs -a
jit_insns/arena_offsets match zero subtests.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109041207.15221-1-yangtiezhu@loongson.cn?part=1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported
2026-11-09 4:25 ` sashiko-bot
@ 2026-11-09 6:10 ` Tiezhu Yang
0 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2026-11-09 6:10 UTC (permalink / raw)
To: sashiko-reviews; +Cc: bpf
On 11/9/26 12:25 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] selftests/bpf: incomplete jit_insns_arena skip list in
> test_jit_insns()
...
> [Severity: Low]
> Does this else branch miss the remaining subtests in jit_insns_arena?
>
> Commit a9fee553d3db ("selftests/bpf: Extend the JIT instruction tests for
> arm64 encodings") added arena_offsets (built on all architectures) as well as
> arena_offsets_ldsx, arena_offsets_atomics, and arena_acq_rel to
> tools/testing/selftests/bpf/progs/jit_insns_arena.c. When BPF_MAP_TYPE_ARENA
> is unsupported, those subtests are silently omitted rather than registered and
> marked skipped, so targeted runs such as ./test_progs -a
> jit_insns/arena_offsets match zero subtests.
I will introduce test_loader__skip_all_subtests() helper as a generic
utility to avoid hardcoded string arrays in test runners.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf
2026-11-09 4:17 ` sashiko-bot
@ 2026-11-09 6:11 ` Tiezhu Yang
0 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2026-11-09 6:11 UTC (permalink / raw)
To: sashiko-reviews; +Cc: bpf
On 11/9/26 12:17 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] selftests/bpf: missing Fixes trailer for commit 6dc03dc71387
...
> [Severity: Low]
> This fixes the unaligned packet offset in test_pkt_write_access_subprog()
> and new_test_pkt_write_access_subprog(). Should this include:
>
> Fixes: 6dc03dc71387 ("selftests/bpf: Add test for freplace program with write access")
I will add Fixes tag in v3.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-09 6:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 4:12 [PATCH bpf-next v2 0/2] selftests/bpf: Handle some unexpected failures Tiezhu Yang
2026-11-09 4:12 ` [PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported Tiezhu Yang
2026-11-09 4:25 ` sashiko-bot
2026-11-09 6:10 ` Tiezhu Yang
2026-11-09 4:12 ` [PATCH bpf-next v2 2/2] selftests/bpf: Fix unaligned access failure in fexit_bpf2bpf Tiezhu Yang
2026-11-09 4:17 ` sashiko-bot
2026-11-09 6:11 ` Tiezhu Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox