xref: /linux/tools/testing/selftests/bpf/progs/tracing_multi_intersect_attach.c (revision 9d19ca5d0e8b4a3f4b2eaa14e86a25f1c93ff35b)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <vmlinux.h>
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_tracing.h>
5 
6 char _license[] SEC("license") = "GPL";
7 
8 __hidden extern int tracing_multi_arg_check(__u64 *ctx, __u64 *test_result, bool is_return);
9 
10 __u64 test_result_fentry_1 = 0;
11 __u64 test_result_fentry_2 = 0;
12 __u64 test_result_fexit_1 = 0;
13 __u64 test_result_fexit_2 = 0;
14 __u64 test_result_fentry = 0;
15 
16 SEC("fentry/bpf_fentry_test1")
17 int BPF_PROG(fentry)
18 {
19 	tracing_multi_arg_check(ctx, &test_result_fentry, false);
20 	return 0;
21 }
22 
23 SEC("fentry.multi")
24 int BPF_PROG(fentry_1)
25 {
26 	tracing_multi_arg_check(ctx, &test_result_fentry_1, false);
27 	return 0;
28 }
29 
30 SEC("fentry.multi")
31 int BPF_PROG(fentry_2)
32 {
33 	tracing_multi_arg_check(ctx, &test_result_fentry_2, false);
34 	return 0;
35 }
36 
37 SEC("fexit.multi")
38 int BPF_PROG(fexit_1)
39 {
40 	tracing_multi_arg_check(ctx, &test_result_fexit_1, true);
41 	return 0;
42 }
43 
44 SEC("fexit.multi")
45 int BPF_PROG(fexit_2)
46 {
47 	tracing_multi_arg_check(ctx, &test_result_fexit_2, true);
48 	return 0;
49 }
50