bpf: selftests: Add selftests for module kfunc support
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sat, 2 Oct 2021 01:17:57 +0000 (06:47 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 6 Oct 2021 00:07:42 +0000 (17:07 -0700)
commitc48e51c8b07aba8a18125221cb67a40cb1256bf2
treebe96b11f4bdd8494e6c1f2f44fcb7a725237ecc4
parent18f4fccbf314fdb07d276f4cd3eaf53f1825550d
bpf: selftests: Add selftests for module kfunc support

This adds selftests that tests the success and failure path for modules
kfuncs (in presence of invalid kfunc calls) for both libbpf and
gen_loader. It also adds a prog_test kfunc_btf_id_list so that we can
add module BTF ID set from bpf_testmod.

This also introduces  a couple of test cases to verifier selftests for
validating whether we get an error or not depending on if invalid kfunc
call remains after elimination of unreachable instructions.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211002011757.311265-10-memxor@gmail.com
include/linux/btf.h
kernel/bpf/btf.c
net/bpf/test_run.c
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/prog_tests/ksyms_module.c
tools/testing/selftests/bpf/prog_tests/ksyms_module_libbpf.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_ksyms_module.c
tools/testing/selftests/bpf/verifier/calls.c