bpf, selftest: test {rd, wr}only flags and direct value access
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 9 Apr 2019 21:20:16 +0000 (23:20 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Apr 2019 00:05:47 +0000 (17:05 -0700)
commitfb2abb73e575b6fcb428f803faf928ef04d5bb1e
treecb15ca8b67f832fede7ec54d05a7d68664aa0591
parent817998afa038c156bbc1a6e69c48aa26282cc41f
bpf, selftest: test {rd, wr}only flags and direct value access

Extend test_verifier with various test cases around the two kernel
extensions, that is, {rd,wr}only map support as well as direct map
value access. All passing, one skipped due to xskmap not present
on test machine:

  # ./test_verifier
  [...]
  #948/p XDP pkt read, pkt_meta' <= pkt_data, bad access 1 OK
  #949/p XDP pkt read, pkt_meta' <= pkt_data, bad access 2 OK
  #950/p XDP pkt read, pkt_data <= pkt_meta', good access OK
  #951/p XDP pkt read, pkt_data <= pkt_meta', bad access 1 OK
  #952/p XDP pkt read, pkt_data <= pkt_meta', bad access 2 OK
  Summary: 1410 PASSED, 1 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/include/linux/filter.h
tools/testing/selftests/bpf/test_verifier.c
tools/testing/selftests/bpf/verifier/array_access.c
tools/testing/selftests/bpf/verifier/direct_value_access.c [new file with mode: 0644]