selftests/bpf: Add test for freplace program with write access
authorUdip Pant <udippant@fb.com>
Tue, 25 Aug 2020 23:20:01 +0000 (16:20 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 26 Aug 2020 19:47:56 +0000 (12:47 -0700)
commit6dc03dc71387e1dc65cf14efb49e5cf7062a2d46
tree46675c899ce84ed38a4d43e93796afa7ca600468
parent7e40781cc8b767dd6530910ae12d75978d7d68e1
selftests/bpf: Add test for freplace program with write access

This adds a selftest that tests the behavior when a freplace target program
attempts to make a write access on a packet. The expectation is that the read or write
access is granted based on the program type of the linked program and
not itself (which is of type, for e.g., BPF_PROG_TYPE_EXT).

This test fails without the associated patch on the verifier.

Signed-off-by: Udip Pant <udippant@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200825232003.2877030-3-udippant@fb.com
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c
tools/testing/selftests/bpf/progs/test_pkt_access.c