selftests/bpf: Add verifier tests for bpf_lookup_*_key() and bpf_key_put()
authorRoberto Sassu <roberto.sassu@huawei.com>
Tue, 20 Sep 2022 07:59:48 +0000 (09:59 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 22 Sep 2022 00:32:49 +0000 (17:32 -0700)
commit7c036ed9e0065e852fb1886d9ea97ceb35680e3f
treeb0bcfc61981fa7ce6dfdee335bb0d18daefab28d
parent94fd7420faa0bc85341c0a9cbe5e5240ef4f123d
selftests/bpf: Add verifier tests for bpf_lookup_*_key() and bpf_key_put()

Add verifier tests for bpf_lookup_*_key() and bpf_key_put(), to ensure that
acquired key references stored in the bpf_key structure are released, that
a non-NULL bpf_key pointer is passed to bpf_key_put(), and that key
references are not leaked.

Also, slightly modify test_verifier.c, to find the BTF ID of the attach
point for the LSM program type (currently, it is done only for TRACING).

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220920075951.929132-11-roberto.sassu@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/config
tools/testing/selftests/bpf/test_verifier.c
tools/testing/selftests/bpf/verifier/ref_tracking.c