selftests: Add selftest for disallowing modify_return attachment to freplace
authorToke Høiland-Jørgensen <toke@redhat.com>
Tue, 29 Sep 2020 12:45:57 +0000 (14:45 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 29 Sep 2020 20:09:24 +0000 (13:09 -0700)
commitbee4b7e6268be9267e288936f5b1215fec3d4368
tree1963385635b40446667c35f61b2bf74f1c9779d1
parent17d3f386757609223aa02342d29526daa67efafc
selftests: Add selftest for disallowing modify_return attachment to freplace

This adds a selftest that ensures that modify_return tracing programs
cannot be attached to freplace programs. The security_ prefix is added to
the freplace program because that would otherwise let it pass the check for
modify_return.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/160138355713.48470.3811074984255709369.stgit@toke.dk
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
tools/testing/selftests/bpf/progs/fmod_ret_freplace.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/freplace_get_constant.c