[PATCH bpf-next v2 1/2] selftests/bpf: Skip jit_insns_arena tests if not supported
From: Tiezhu Yang
Date: Sun Nov 08 2026 - 23:12:29 EST
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@xxxxxxxxxxx>
---
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