selftests/bpf: add tests for the "module: Function" syntax

The previous patch added support for the "module:function" syntax for
tracing programs. This adds tests for explicitly specifying the module
name via the SEC macro and via the bpf_program__set_attach_target call.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/8a076168ed847f7c8a6c25715737b1fea84e38be.1714469650.git.vmalik@redhat.com
This commit is contained in:
Viktor Malik
2024-04-30 11:38:07 +02:00
committed by Andrii Nakryiko
parent 8f8a024272
commit 960635887c
2 changed files with 29 additions and 0 deletions

View File

@@ -73,6 +73,29 @@ int BPF_PROG(handle_fentry_manual,
return 0;
}
__u32 fentry_explicit_read_sz = 0;
SEC("fentry/bpf_testmod:bpf_testmod_test_read")
int BPF_PROG(handle_fentry_explicit,
struct file *file, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf, loff_t off, size_t len)
{
fentry_explicit_read_sz = len;
return 0;
}
__u32 fentry_explicit_manual_read_sz = 0;
SEC("fentry")
int BPF_PROG(handle_fentry_explicit_manual,
struct file *file, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf, loff_t off, size_t len)
{
fentry_explicit_manual_read_sz = len;
return 0;
}
__u32 fexit_read_sz = 0;
int fexit_ret = 0;