1 | // SPDX-License-Identifier: GPL-2.0 |
2 | /* Copyright (C) 2023 Yafang Shao <laoar.shao@gmail.com> */ |
3 | |
4 | #include "vmlinux.h" |
5 | #include <bpf/bpf_tracing.h> |
6 | |
7 | char tp_name[128]; |
8 | |
9 | SEC("lsm.s/bpf" ) |
10 | int BPF_PROG(lsm_run, int cmd, union bpf_attr *attr, unsigned int size) |
11 | { |
12 | switch (cmd) { |
13 | case BPF_RAW_TRACEPOINT_OPEN: |
14 | bpf_copy_from_user(tp_name, sizeof(tp_name) - 1, |
15 | (void *)attr->raw_tracepoint.name); |
16 | break; |
17 | default: |
18 | break; |
19 | } |
20 | return 0; |
21 | } |
22 | |
23 | SEC("raw_tracepoint" ) |
24 | int BPF_PROG(raw_tp_run) |
25 | { |
26 | return 0; |
27 | } |
28 | |
29 | char _license[] SEC("license" ) = "GPL" ; |
30 | |