On Sun, May 31, 2026 at 6:52 AM Woojin Ji <[email protected]> wrote: > > Commit 2845989f2eba ("bpf: Validate node_id in arena_alloc_pages()") > added validation for invalid or offline NUMA node ids in > arena_alloc_pages(), but there is no selftest covering invalid node id > allocation failure. > > Add a verifier_arena test that calls bpf_arena_alloc_pages() with an > invalid node id and checks that allocation fails. > > Tested with: > ./test_progs -t verifier_arena/alloc_pages_invalid_node > > Signed-off-by: Woojin Ji <[email protected]> > --- > .../testing/selftests/bpf/progs/verifier_arena.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/tools/testing/selftests/bpf/progs/verifier_arena.c > b/tools/testing/selftests/bpf/progs/verifier_arena.c > index 62e282f4448a..91aa0941ded2 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_arena.c > +++ b/tools/testing/selftests/bpf/progs/verifier_arena.c > @@ -11,6 +11,7 @@ > #include "bpf_arena_common.h" > > #define private(name) SEC(".bss." #name) __hidden __attribute__((aligned(8))) > +#define INVALID_NODE_ID 0x7fffffff > > struct { > __uint(type, BPF_MAP_TYPE_ARENA); > @@ -199,6 +200,20 @@ int basic_alloc3(void *ctx) > return 0; > } > > +SEC("syscall") > +__success __retval(0) > +int alloc_pages_invalid_node(void *ctx) > +{ > +#if defined(__BPF_FEATURE_ADDR_SPACE_CAST) > + void __arena *page; > + > + page = bpf_arena_alloc_pages(&arena, NULL, 1, INVALID_NODE_ID, 0); > + if (page) > + return 1; > +#endif > + return 0;
I don't think we need a selftest for every little fix. This will take more CI time for things that are unlikely to break. pw-bot: cr
