diff options
| author | Andrii Nakryiko <andrii@kernel.org> | 2024-03-19 16:38:52 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2024-03-19 23:05:34 -0700 |
| commit | 51146ff0fae309a558bc8ab6cbf6cfda17356993 (patch) | |
| tree | 53411f9aa32fbcae919dc97e705a7598893d5156 /tools/testing/selftests/bpf/progs/test_bpf_cookie.c | |
| parent | 36ffb2023e3703a64266ca5fed30f710b1263c70 (diff) | |
| download | linux-51146ff0fae309a558bc8ab6cbf6cfda17356993.tar.gz linux-51146ff0fae309a558bc8ab6cbf6cfda17356993.tar.bz2 linux-51146ff0fae309a558bc8ab6cbf6cfda17356993.zip | |
selftests/bpf: add raw_tp/tp_btf BPF cookie subtests
Add test validating BPF cookie can be passed during raw_tp/tp_btf
attachment and can be retried at runtime with bpf_get_attach_cookie()
helper.
Acked-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Message-ID: <20240319233852.1977493-6-andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_bpf_cookie.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/test_bpf_cookie.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_bpf_cookie.c b/tools/testing/selftests/bpf/progs/test_bpf_cookie.c index 5a3a80f751c4..c83142b55f47 100644 --- a/tools/testing/selftests/bpf/progs/test_bpf_cookie.c +++ b/tools/testing/selftests/bpf/progs/test_bpf_cookie.c @@ -15,6 +15,8 @@ __u64 uprobe_res; __u64 uretprobe_res; __u64 tp_res; __u64 pe_res; +__u64 raw_tp_res; +__u64 tp_btf_res; __u64 fentry_res; __u64 fexit_res; __u64 fmod_ret_res; @@ -87,6 +89,20 @@ int handle_pe(struct pt_regs *ctx) return 0; } +SEC("raw_tp/sys_enter") +int handle_raw_tp(void *ctx) +{ + update(ctx, &raw_tp_res); + return 0; +} + +SEC("tp_btf/sys_enter") +int handle_tp_btf(void *ctx) +{ + update(ctx, &tp_btf_res); + return 0; +} + SEC("fentry/bpf_fentry_test1") int BPF_PROG(fentry_test1, int a) { |
