This source file includes following definitions.
- SEC
1
2
3
4 #include <linux/bpf.h>
5 #include <stdint.h>
6 #include "bpf_helpers.h"
7
8 char _license[] SEC("license") = "GPL";
9
10 static volatile struct data {
11 char in[256];
12 char out[256];
13 } data;
14
15 struct core_reloc_misc_output {
16 int a, b, c;
17 };
18
19 struct core_reloc_misc___a {
20 int a1;
21 int a2;
22 };
23
24 struct core_reloc_misc___b {
25 int b1;
26 int b2;
27 };
28
29
30 struct core_reloc_misc_extensible {
31 int a;
32 int b;
33 };
34
35 SEC("raw_tracepoint/sys_enter")
36 int test_core_misc(void *ctx)
37 {
38 struct core_reloc_misc___a *in_a = (void *)&data.in;
39 struct core_reloc_misc___b *in_b = (void *)&data.in;
40 struct core_reloc_misc_extensible *in_ext = (void *)&data.in;
41 struct core_reloc_misc_output *out = (void *)&data.out;
42
43
44 if (BPF_CORE_READ(&out->a, &in_a->a1) ||
45 BPF_CORE_READ(&out->b, &in_b->b1))
46 return 1;
47
48
49
50
51
52 if (BPF_CORE_READ(&out->c, &in_ext[2]))
53 return 1;
54
55 return 0;
56 }
57