]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: Add tests for arena fault reporting
authorPuranjay Mohan <puranjay@kernel.org>
Thu, 11 Sep 2025 14:58:05 +0000 (14:58 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 11 Sep 2025 20:00:44 +0000 (13:00 -0700)
commit86f2225065be5af2935f374f1a3abebc052c0868
treeb1e6774ab71d896d0ff2cd20132f3d6e266857bc
parentedd03fcd7601ce41068c183875c2cd3471a49f9a
selftests/bpf: Add tests for arena fault reporting

Add selftests for testing the reporting of arena page faults through BPF
streams. Two new bpf programs are added that read and write to an
unmapped arena address and the fault reporting is verified in the
userspace through streams.

The added bpf programs need to access the user_vm_start in struct
bpf_arena, this is done by casting &arena to struct bpf_arena *, but
barrier_var() is used on this ptr before accessing ptr->user_vm_start;
to stop GCC from issuing an out-of-bound access due to the cast from
smaller map struct to larger "struct bpf_arena"

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20250911145808.58042-7-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/stream.c
tools/testing/selftests/bpf/progs/stream.c