1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2019 Facebook */
3 
4 #include <stdbool.h>
5 #include <linux/bpf.h>
6 #include <bpf/bpf_helpers.h>
7 
8 struct s {
9 	int a;
10 	long long b;
11 } __attribute__((packed));
12 
13 /* .data section */
14 int in1 = -1;
15 long long in2 = -1;
16 
17 /* .bss section */
18 char in3 = '\0';
19 long long in4 __attribute__((aligned(64))) = 0;
20 struct s in5 = {};
21 
22 /* .rodata section */
23 const volatile int in6 = 0;
24 
25 /* .data section */
26 int out1 = -1;
27 long long out2 = -1;
28 
29 /* .bss section */
30 char out3 = 0;
31 long long out4 = 0;
32 int out6 = 0;
33 
34 extern bool CONFIG_BPF_SYSCALL __kconfig;
35 extern int LINUX_KERNEL_VERSION __kconfig;
36 bool bpf_syscall = 0;
37 int kern_ver = 0;
38 
39 SEC("raw_tp/sys_enter")
40 int handler(const void *ctx)
41 {
42 	static volatile struct s out5;
43 
44 	out1 = in1;
45 	out2 = in2;
46 	out3 = in3;
47 	out4 = in4;
48 	out5 = in5;
49 	out6 = in6;
50 
51 	bpf_syscall = CONFIG_BPF_SYSCALL;
52 	kern_ver = LINUX_KERNEL_VERSION;
53 
54 	return 0;
55 }
56 
57 char _license[] SEC("license") = "GPL";
58