1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/ptrace.h>
4 #include <linux/bpf.h>
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_tracing.h>
7 
8 struct pt_regs current_regs = {};
9 struct pt_regs ctx_regs = {};
10 int uprobe_res = 0;
11 
12 SEC("uprobe/trigger_func")
13 int handle_uprobe(struct pt_regs *ctx)
14 {
15 	struct task_struct *current;
16 	struct pt_regs *regs;
17 
18 	current = bpf_get_current_task_btf();
19 	regs = (struct pt_regs *) bpf_task_pt_regs(current);
20 	__builtin_memcpy(&current_regs, regs, sizeof(*regs));
21 	__builtin_memcpy(&ctx_regs, ctx, sizeof(*ctx));
22 
23 	/* Prove that uprobe was run */
24 	uprobe_res = 1;
25 
26 	return 0;
27 }
28 
29 char _license[] SEC("license") = "GPL";
30