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_flavors {
16 int a;
17 int b;
18 int c;
19 };
20
21
22 struct core_reloc_flavors___reversed {
23 int c;
24 int b;
25 int a;
26 };
27
28
29 struct core_reloc_flavors___weird {
30 struct {
31 int b;
32 };
33
34
35
36 union {
37 int a;
38 int c;
39 };
40 };
41
42 SEC("raw_tracepoint/sys_enter")
43 int test_core_flavors(void *ctx)
44 {
45 struct core_reloc_flavors *in_orig = (void *)&data.in;
46 struct core_reloc_flavors___reversed *in_rev = (void *)&data.in;
47 struct core_reloc_flavors___weird *in_weird = (void *)&data.in;
48 struct core_reloc_flavors *out = (void *)&data.out;
49
50
51 if (BPF_CORE_READ(&out->a, &in_weird->a))
52 return 1;
53
54 if (BPF_CORE_READ(&out->b, &in_rev->b))
55 return 1;
56
57 if (BPF_CORE_READ(&out->c, &in_orig->c))
58 return 1;
59
60 return 0;
61 }
62