selftests/bpf: test_verifier, check bpf_map_lookup_elem access in bpf prog
authorPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Tue, 9 Oct 2018 01:04:54 +0000 (10:04 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Oct 2018 04:52:20 +0000 (21:52 -0700)
commit7c85c448e7d74c4ddd759440a2141eab663567cf
tree498d230771d811b1153e5a9eae801ecc7a675dc8
parent908142e61b2e9c2411e8bc4e5092a6ab06eca8e4
selftests/bpf: test_verifier, check bpf_map_lookup_elem access in bpf prog

map_lookup_elem isn't supported by certain map types like:
- BPF_MAP_TYPE_PROG_ARRAY
- BPF_MAP_TYPE_STACK_TRACE
- BPF_MAP_TYPE_XSKMAP
- BPF_MAP_TYPE_SOCKMAP/BPF_MAP_TYPE_SOCKHASH
Let's add verfier tests to check whether verifier prevents
bpf_map_lookup_elem call on above programs from bpf program.

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_verifier.c