1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2017 Facebook
4 #include <linux/ptrace.h>
6 #include "bpf_helpers.h"
9 __uint(type
, BPF_MAP_TYPE_ARRAY
);
10 __uint(max_entries
, 4);
13 } results_map
SEC(".maps");
15 SEC("kprobe/sys_nanosleep")
16 int handle_sys_nanosleep_entry(struct pt_regs
*ctx
)
18 const int key
= 0, value
= 1;
20 bpf_map_update_elem(&results_map
, &key
, &value
, 0);
24 SEC("kretprobe/sys_nanosleep")
25 int handle_sys_getpid_return(struct pt_regs
*ctx
)
27 const int key
= 1, value
= 2;
29 bpf_map_update_elem(&results_map
, &key
, &value
, 0);
33 SEC("uprobe/trigger_func")
34 int handle_uprobe_entry(struct pt_regs
*ctx
)
36 const int key
= 2, value
= 3;
38 bpf_map_update_elem(&results_map
, &key
, &value
, 0);
42 SEC("uretprobe/trigger_func")
43 int handle_uprobe_return(struct pt_regs
*ctx
)
45 const int key
= 3, value
= 4;
47 bpf_map_update_elem(&results_map
, &key
, &value
, 0);
51 char _license
[] SEC("license") = "GPL";
52 __u32 _version
SEC("version") = 1;