0001
0002
0003 #include "vmlinux.h"
0004 #include <bpf/bpf_helpers.h>
0005 #include <bpf/bpf_tracing.h>
0006
0007 #define PT_REGS_SIZE sizeof(struct pt_regs)
0008
0009
0010
0011
0012
0013 char current_regs[PT_REGS_SIZE] = {};
0014 char ctx_regs[PT_REGS_SIZE] = {};
0015 int uprobe_res = 0;
0016
0017 SEC("uprobe")
0018 int handle_uprobe(struct pt_regs *ctx)
0019 {
0020 struct task_struct *current;
0021 struct pt_regs *regs;
0022
0023 current = bpf_get_current_task_btf();
0024 regs = (struct pt_regs *) bpf_task_pt_regs(current);
0025 if (bpf_probe_read_kernel(current_regs, PT_REGS_SIZE, regs))
0026 return 0;
0027 if (bpf_probe_read_kernel(ctx_regs, PT_REGS_SIZE, ctx))
0028 return 0;
0029
0030
0031 uprobe_res = 1;
0032
0033 return 0;
0034 }
0035
0036 char _license[] SEC("license") = "GPL";