selftests/bpf: Add unit tests with __bpf_trap() kfunc
authorYonghong Song <yonghong.song@linux.dev>
Fri, 23 May 2025 20:53:31 +0000 (13:53 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 27 May 2025 17:30:07 +0000 (10:30 -0700)
commit92de53d247dffdf29d2abecf7deb4760dde98d6c
treeeb2f156b17093645f4ee76ada91fa002a56f3b1e
parentf95695f2c46592b4260032736a9bfc6e2a01c77c
selftests/bpf: Add unit tests with __bpf_trap() kfunc

Add some inline-asm tests and C tests where __bpf_trap() or
__builtin_trap() is used in the code. The __builtin_trap()
test is guarded with llvm21 ([1]) since otherwise the compilation
failure will happen.

  [1] https://github.com/llvm/llvm-project/pull/131731

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20250523205331.1291734-1-yonghong.song@linux.dev
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_bpf_trap.c [new file with mode: 0644]