]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Add tests for kfunc returning a memory pointer
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tue, 6 Sep 2022 15:13:03 +0000 (17:13 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Sep 2022 18:05:17 +0000 (11:05 -0700)
commitabb6dd565c0198f0b6cd618fd1aa9196a7063fc4
tree71f1dcd0c61e046ea690010f4cb2a8f96d7bc569
parent7c9da8517bd0028d85e48bfbe3de39a23fee037e
selftests/bpf: Add tests for kfunc returning a memory pointer

We add 2 new kfuncs that are following the RET_PTR_TO_MEM
capability from the previous commit.
Then we test them in selftests:
the first tests are testing valid case, and are not failing,
and the later ones are actually preventing the program to be loaded
because they are wrong.

To work around that, we mark the failing ones as not autoloaded
(with SEC("?tc")), and we manually enable them one by one, ensuring
the verifier rejects them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20220906151303.2780789-8-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
tools/testing/selftests/bpf/progs/kfunc_call_test.c