1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// SPDX-License-Identifier: GPL-2.0
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
__hidden extern int tracing_multi_arg_check(__u64 *ctx, __u64 *test_result, bool is_return);
__u64 test_result_fentry = 0;
__u64 test_result_fexit = 0;
SEC("fsession.multi/bpf_fentry_test*")
int BPF_PROG(test_session_1)
{
volatile __u64 *cookie = bpf_session_cookie(ctx);
if (bpf_session_is_return(ctx)) {
if (tracing_multi_arg_check(ctx, &test_result_fexit, true))
return 0;
/* extra count for test_result_fexit cookie */
test_result_fexit += *cookie == 0xbeafbeafbeafbeaf;
} else {
if (tracing_multi_arg_check(ctx, &test_result_fentry, false))
return 0;
*cookie = 0xbeafbeafbeafbeaf;
}
return 0;
}
SEC("fsession.multi.s/bpf_fentry_test1")
int BPF_PROG(test_fsession_s)
{
volatile __u64 *cookie = bpf_session_cookie(ctx);
if (bpf_session_is_return(ctx)) {
if (tracing_multi_arg_check(ctx, &test_result_fexit, true))
return 0;
/* extra count for test_result_fexit cookie */
test_result_fexit += *cookie == 0xbeafbeafbeafbeaf;
} else {
if (tracing_multi_arg_check(ctx, &test_result_fentry, false))
return 0;
*cookie = 0xbeafbeafbeafbeaf;
}
return 0;
}
SEC("fsession.multi/bpf_testmod:bpf_testmod_fentry_test*")
int BPF_PROG(test_session_2)
{
volatile __u64 *cookie = bpf_session_cookie(ctx);
if (bpf_session_is_return(ctx)) {
if (tracing_multi_arg_check(ctx, &test_result_fexit, true))
return 0;
/* extra count for test_result_fexit cookie */
test_result_fexit += *cookie == 0xbeafbeafbeafbeaf;
} else {
if (tracing_multi_arg_check(ctx, &test_result_fentry, false))
return 0;
*cookie = 0xbeafbeafbeafbeaf;
}
return 0;
}
|