]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: add test for accessing ctx from syscall program type
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tue, 6 Sep 2022 15:13:00 +0000 (17:13 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Sep 2022 18:04:27 +0000 (11:04 -0700)
commit47a541059464652a79ecf4f819c8d8530077d9f1
treedcf688c426b2db8ce56f2b755be5f0e7c50b2d38
parenta3d6e01de722e6250740ee37cd020aca7b5df3ee
selftests/bpf: add test for accessing ctx from syscall program type

We need to also export the kfunc set to the syscall program type,
and then add a couple of eBPF programs that are testing those calls.

The first one checks for valid access, and the second one is OK
from a static analysis point of view but fails at run time because
we are trying to access outside of the allocated memory.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20220906151303.2780789-5-benjamin.tissoires@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/bpf/test_run.c
tools/testing/selftests/bpf/prog_tests/kfunc_call.c
tools/testing/selftests/bpf/progs/kfunc_call_fail.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/kfunc_call_test.c