diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2020-12-12 00:58:25 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-12-14 18:39:42 +0300 |
commit | 2e33f831fccd2df83836a8e255755f85d364aaeb (patch) | |
tree | ff11615e400b722b99c1f1c9f6fec5feb6495c4d /tools/testing/selftests/bpf/progs | |
parent | fe62de310e2b563c0d303a09d06b020077fe86b4 (diff) | |
download | linux-2e33f831fccd2df83836a8e255755f85d364aaeb.tar.xz |
selftests/bpf: Add set_attach_target() API selftest for module target
Add test for bpf_program__set_attach_target() API, validating it can find
kernel module fentry target.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20201211215825.3646154-3-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/progs')
-rw-r--r-- | tools/testing/selftests/bpf/progs/test_module_attach.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_module_attach.c b/tools/testing/selftests/bpf/progs/test_module_attach.c index b563563df172..efd1e287ac17 100644 --- a/tools/testing/selftests/bpf/progs/test_module_attach.c +++ b/tools/testing/selftests/bpf/progs/test_module_attach.c @@ -38,6 +38,17 @@ int BPF_PROG(handle_fentry, return 0; } +__u32 fentry_manual_read_sz = 0; + +SEC("fentry/placeholder") +int BPF_PROG(handle_fentry_manual, + struct file *file, struct kobject *kobj, + struct bin_attribute *bin_attr, char *buf, loff_t off, size_t len) +{ + fentry_manual_read_sz = len; + return 0; +} + __u32 fexit_read_sz = 0; int fexit_ret = 0; |