]> Git Repo - J-linux.git/blob - tools/testing/selftests/bpf/progs/test_ptr_untrusted.c
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / tools / testing / selftests / bpf / progs / test_ptr_untrusted.c
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2023 Yafang Shao <[email protected]> */
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";
This page took 0.027255 seconds and 4 git commands to generate.