]> Git Repo - J-linux.git/blob - tools/testing/selftests/bpf/progs/test_probe_read_user_str.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_probe_read_user_str.c
1 // SPDX-License-Identifier: GPL-2.0
2
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 #include <bpf/bpf_tracing.h>
6
7 #include <sys/types.h>
8
9 pid_t pid = 0;
10 long ret = 0;
11 void *user_ptr = 0;
12 char buf[256] = {};
13
14 SEC("tracepoint/syscalls/sys_enter_nanosleep")
15 int on_write(void *ctx)
16 {
17         if (pid != (bpf_get_current_pid_tgid() >> 32))
18                 return 0;
19
20         ret = bpf_probe_read_user_str(buf, sizeof(buf), user_ptr);
21
22         return 0;
23 }
24
25 char _license[] SEC("license") = "GPL";
This page took 0.028049 seconds and 4 git commands to generate.