[PATCH bpf-next v3 2/4] selftests/bpf: Skip jit_insns_arena tests if not supported
From: Tiezhu Yang
Date: Sun Nov 15 2026 - 22:59: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,
use SKIP_TESTS() to cleanly report all subtests within the skeleton as
skipped.
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 | 6 +++++-
1 file changed, 5 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..4110b1ff6ff8 100644
--- a/tools/testing/selftests/bpf/prog_tests/jit_insns.c
+++ b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
@@ -3688,7 +3688,11 @@ 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
+ SKIP_TESTS(jit_insns_arena);
+
if (test__start_subtest("alu_imm"))
test_alu_imm();
if (test__start_subtest("alu_reg"))
--
2.42.0