selftests/bpf: Add negative C tests for kptrs
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Wed, 11 May 2022 19:46:53 +0000 (01:16 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 11 May 2022 23:57:27 +0000 (16:57 -0700)
commit04accf794bb2a5a06f23f7d48d195ffa329181a6
tree9b01d19c410bdea46a363aa3724f4d93d29535b5
parent5cdccadcac2612f947ebc26ad7023dfb7e8871f9
selftests/bpf: Add negative C tests for kptrs

This uses the newly added SEC("?foo") naming to disable autoload of
programs, and then loads them one by one for the object and verifies
that loading fails and matches the returned error string from verifier.
This is similar to already existing verifier tests but provides coverage
for BPF C.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220511194654.765705-4-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/map_kptr.c
tools/testing/selftests/bpf/progs/map_kptr_fail.c [new file with mode: 0644]