* [PATCH bpf-next v1 3/7] selftests/bpf: report SKIP for arena tests a compiler cannot build
@ 2026-10-28 0:04 Vineet Gupta
2026-10-28 0:13 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Vineet Gupta @ 2026-10-28 0:04 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
yonghong.song, jolsa, emil, ihor.solodrai, john.fastabend, shuah,
linux-kernel, linux-kselftest, jose.marchesi, david.faust,
Vineet Gupta
Tests guarded by __BPF_FEATURE_ADDR_SPACE_CAST don't have a dummy fall back
when the compiler doesn't support the feature: so they are absent from such
a report entirely.
Every subtest inside one of those guards is invisible: 22 across six files,
plus the five in stream_arena_fault_address, which has no guard and fails to
load instead (addressed separately, later in this series).
Give each guard an #else with a dummy marked __skip(), so the skip gap is
reported rather than invisible. Add __skip_without_arena for it, which
expands to __skip() with a fixed reason when the compiler cannot do arena.
Measured on bpf-next with a stock bpf-gcc, test_progs before and after:
six subtests appear that were previously absent from the report
altogether, and arena_kfunc_jit goes OK -> SKIP because every subtest
it has is now one of them.
arena_kfunc_jit/arena_unsupported SKIP
compute_live_registers/arena_unsupported SKIP
verifier_arena/arena_unsupported SKIP
verifier_arena_large/arena_unsupported SKIP
verifier_ldsx/arena_unsupported SKIP
verifier_zext/arena_unsupported SKIP
Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
---
.../testing/selftests/bpf/progs/arena_kfunc_jit.c | 9 +++++++++
tools/testing/selftests/bpf/progs/bpf_misc.h | 14 ++++++++++++++
.../selftests/bpf/progs/compute_live_registers.c | 10 ++++++++++
tools/testing/selftests/bpf/progs/verifier_arena.c | 9 +++++++++
.../selftests/bpf/progs/verifier_arena_large.c | 10 ++++++++++
tools/testing/selftests/bpf/progs/verifier_ldsx.c | 9 +++++++++
tools/testing/selftests/bpf/progs/verifier_zext.c | 9 +++++++++
7 files changed, 70 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c b/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
index b5a01cbc33a7..97912a7b6b5e 100644
--- a/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
+++ b/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
@@ -112,6 +112,15 @@ int arena_arg_jit_args5(void *ctx)
(u64 *)&val[4]);
return 0;
}
+#else
+
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
#endif /* __BPF_FEATURE_ADDR_SPACE_CAST */
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index 1b264480e128..ed1ed1b5bd09 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -116,6 +116,10 @@
* feature the toolchain or JIT cannot provide, so a run does
* not report OK for coverage it never executed.
*
+ * __skip_without_arena
+ * __skip() with a fixed reason when the compiler cannot do
+ * the arena address space, nothing otherwise.
+ *
* __log_level Log level to use for the program, numeric value expected.
*
* __flag Adds one flag use for the program, the following values are valid:
@@ -156,6 +160,16 @@
#define __success __test_tag("test_expect_success")
#define __description(desc) __test_tag("test_description=" desc)
#define __skip(reason) __test_tag("test_skip=" reason)
+
+/*
+ * Without compiler arena support, report the test as SKIP rather than let it
+ * pass vacuously or fail to load.
+ */
+#ifdef __BPF_FEATURE_ADDR_SPACE_CAST
+#define __skip_without_arena
+#else
+#define __skip_without_arena __skip("compiler does not support the arena address space")
+#endif
#define __msg_unpriv(msg) __test_tag("test_expect_msg_unpriv=" msg)
#define __not_msg_unpriv(msg) __test_tag("test_expect_not_msg_unpriv=" msg)
#define __msg_next_unpriv(msg) __test_tag("test_expect_msg_next_unpriv=" msg)
diff --git a/tools/testing/selftests/bpf/progs/compute_live_registers.c b/tools/testing/selftests/bpf/progs/compute_live_registers.c
index 1ff24bbc7beb..e05431600358 100644
--- a/tools/testing/selftests/bpf/progs/compute_live_registers.c
+++ b/tools/testing/selftests/bpf/progs/compute_live_registers.c
@@ -403,6 +403,16 @@ __naked void addr_space_cast(void)
__imm_addr(arena)
: __clobber_all);
}
+#else
+
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
+
#endif
static __used __naked int aux1(void)
diff --git a/tools/testing/selftests/bpf/progs/verifier_arena.c b/tools/testing/selftests/bpf/progs/verifier_arena.c
index 1ce9c4b78481..3b3410802825 100644
--- a/tools/testing/selftests/bpf/progs/verifier_arena.c
+++ b/tools/testing/selftests/bpf/progs/verifier_arena.c
@@ -713,6 +713,15 @@ __naked void mixed_arena_stack_atomic(void)
__imm(bpf_get_prandom_u32)
: __clobber_all);
}
+#else
+
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
#endif /* defined(__BPF_FEATURE_ADDR_SPACE_CAST) */
diff --git a/tools/testing/selftests/bpf/progs/verifier_arena_large.c b/tools/testing/selftests/bpf/progs/verifier_arena_large.c
index dbdea14ca76f..34f0a0f88e12 100644
--- a/tools/testing/selftests/bpf/progs/verifier_arena_large.c
+++ b/tools/testing/selftests/bpf/progs/verifier_arena_large.c
@@ -348,5 +348,15 @@ int big_alloc4(void *ctx)
#endif
return 0;
}
+#else
+
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
+
#endif
char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c
index 49e8cd4bb4f9..35b20d0796db 100644
--- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c
+++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c
@@ -450,6 +450,15 @@ void kfunc_root(void)
{
bpf_arena_alloc_pages(0, 0, 0, 0, 0);
}
+#else
+
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
#endif /* __BPF_FEATURE_ADDR_SPACE_CAST */
diff --git a/tools/testing/selftests/bpf/progs/verifier_zext.c b/tools/testing/selftests/bpf/progs/verifier_zext.c
index 572017fe28fb..dbfeeea4cf9f 100644
--- a/tools/testing/selftests/bpf/progs/verifier_zext.c
+++ b/tools/testing/selftests/bpf/progs/verifier_zext.c
@@ -381,6 +381,15 @@ __naked void zext_arena_cmpxchg32(void)
BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_1, BPF_REG_2, 0))
: __clobber_all);
}
+#else
+
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
#endif
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next v1 3/7] selftests/bpf: report SKIP for arena tests a compiler cannot build
2026-10-28 0:04 [PATCH bpf-next v1 3/7] selftests/bpf: report SKIP for arena tests a compiler cannot build Vineet Gupta
@ 2026-10-28 0:13 ` sashiko-bot
2026-10-28 16:14 ` Vineet Gupta
0 siblings, 1 reply; 3+ messages in thread
From: sashiko-bot @ 2026-10-28 0:13 UTC (permalink / raw)
To: Vineet Gupta, bpf
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/bpf: missing __skip_without_arena fallback in jit_insns_arena.c
--
commit f37e4c1aa3e5f2decfc920dfa156617c4a66522b
Author: Vineet Gupta <vineet.gupta@linux.dev>
selftests/bpf: report SKIP for arena tests a compiler cannot build
This commit adds a __skip_without_arena macro and #else fallback programs
to BPF selftest files guarded by __BPF_FEATURE_ADDR_SPACE_CAST so that
test_progs reports those subtests as skipped when built with a compiler
that lacks arena address space support.
> diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
> index 1b264480e128f..ed1ed1b5bd097 100644
> --- a/tools/testing/selftests/bpf/progs/bpf_misc.h
> +++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
> @@ -156,6 +160,16 @@
> #define __success __test_tag("test_expect_success")
> #define __description(desc) __test_tag("test_description=" desc)
> #define __skip(reason) __test_tag("test_skip=" reason)
> +
> +/*
> + * Without compiler arena support, report the test as SKIP rather than let it
> + * pass vacuously or fail to load.
> + */
> +#ifdef __BPF_FEATURE_ADDR_SPACE_CAST
> +#define __skip_without_arena
> +#else
> +#define __skip_without_arena __skip("compiler does not support the arena address space")
> +#endif
[Severity: Medium]
Should tools/testing/selftests/bpf/progs/jit_insns_arena.c also receive an
#else fallback with a dummy arena_unsupported() program marked
__skip_without_arena?
In tools/testing/selftests/bpf/progs/jit_insns_arena.c, both BPF programs
in the file (arena_zero_off() and cast_to_user()) are inside a
__BPF_FEATURE_ADDR_SPACE_CAST guard without an #else branch:
tools/testing/selftests/bpf/progs/jit_insns_arena.c:
#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
SEC("syscall")
__success __retval(0)
int arena_zero_off(void *ctx)
{
...
}
SEC("syscall")
__success __retval(0)
int cast_to_user(void *ctx)
{
...
}
#endif
char _license[] SEC("license") = "GPL";
When built with a compiler that does not define
__BPF_FEATURE_ADDR_SPACE_CAST, such as stock bpf-gcc, jit_insns_arena.c
compiles to an object with zero BPF programs. When test_jit_insns() in
tools/testing/selftests/bpf/prog_tests/jit_insns.c runs:
test_jit_insns() -> RUN_TESTS(jit_insns_arena) -> test_loader__run_subtests()
it silently executes zero subtests for jit_insns_arena instead of reporting
a skipped subtest.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261028000411.4010967-1-vineet.gupta@linux.dev?part=3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next v1 3/7] selftests/bpf: report SKIP for arena tests a compiler cannot build
2026-10-28 0:13 ` sashiko-bot
@ 2026-10-28 16:14 ` Vineet Gupta
0 siblings, 0 replies; 3+ messages in thread
From: Vineet Gupta @ 2026-10-28 16:14 UTC (permalink / raw)
To: sashiko-reviews, bpf
On 10/27/26 5:13 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] selftests/bpf: missing __skip_without_arena fallback in jit_insns_arena.c
> --
>
> commit f37e4c1aa3e5f2decfc920dfa156617c4a66522b
> Author: Vineet Gupta <vineet.gupta@linux.dev>
>
> selftests/bpf: report SKIP for arena tests a compiler cannot build
>
> This commit adds a __skip_without_arena macro and #else fallback programs
> to BPF selftest files guarded by __BPF_FEATURE_ADDR_SPACE_CAST so that
> test_progs reports those subtests as skipped when built with a compiler
> that lacks arena address space support.
>
>> diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
>> index 1b264480e128f..ed1ed1b5bd097 100644
>> --- a/tools/testing/selftests/bpf/progs/bpf_misc.h
>> +++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
>> @@ -156,6 +160,16 @@
>> #define __success __test_tag("test_expect_success")
>> #define __description(desc) __test_tag("test_description=" desc)
>> #define __skip(reason) __test_tag("test_skip=" reason)
>> +
>> +/*
>> + * Without compiler arena support, report the test as SKIP rather than let it
>> + * pass vacuously or fail to load.
>> + */
>> +#ifdef __BPF_FEATURE_ADDR_SPACE_CAST
>> +#define __skip_without_arena
>> +#else
>> +#define __skip_without_arena __skip("compiler does not support the arena address space")
>> +#endif
> [Severity: Medium]
> Should tools/testing/selftests/bpf/progs/jit_insns_arena.c also receive an
> #else fallback with a dummy arena_unsupported() program marked
> __skip_without_arena?
>
> In tools/testing/selftests/bpf/progs/jit_insns_arena.c, both BPF programs
> in the file (arena_zero_off() and cast_to_user()) are inside a
> __BPF_FEATURE_ADDR_SPACE_CAST guard without an #else branch:
>
> tools/testing/selftests/bpf/progs/jit_insns_arena.c:
> #if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
> SEC("syscall")
> __success __retval(0)
> int arena_zero_off(void *ctx)
> {
> ...
> }
>
> SEC("syscall")
> __success __retval(0)
> int cast_to_user(void *ctx)
> {
> ...
> }
> #endif
>
> char _license[] SEC("license") = "GPL";
>
> When built with a compiler that does not define
> __BPF_FEATURE_ADDR_SPACE_CAST, such as stock bpf-gcc, jit_insns_arena.c
> compiles to an object with zero BPF programs. When test_jit_insns() in
> tools/testing/selftests/bpf/prog_tests/jit_insns.c runs:
>
> test_jit_insns() -> RUN_TESTS(jit_insns_arena) -> test_loader__run_subtests()
>
> it silently executes zero subtests for jit_insns_arena instead of reporting
> a skipped subtest.
Indeed this was a miss because my prev testing baseline (before rebase)
didn't have it.
Added in v2.
Thx,
-Vineet
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-28 16:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 0:04 [PATCH bpf-next v1 3/7] selftests/bpf: report SKIP for arena tests a compiler cannot build Vineet Gupta
2026-10-28 0:13 ` sashiko-bot
2026-10-28 16:14 ` Vineet Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox