mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
Add a new selftest to check the PTR_UNTRUSTED condition. Below is the result, #160 ptr_untrusted:OK Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Link: https://lore.kernel.org/r/20230713025642.27477-5-laoar.shao@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
29 lines
549 B
C
29 lines
549 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Copyright (C) 2023 Yafang Shao <laoar.shao@gmail.com> */
|
|
|
|
#include "vmlinux.h"
|
|
#include <bpf/bpf_tracing.h>
|
|
|
|
char tp_name[128];
|
|
|
|
SEC("lsm/bpf")
|
|
int BPF_PROG(lsm_run, int cmd, union bpf_attr *attr, unsigned int size)
|
|
{
|
|
switch (cmd) {
|
|
case BPF_RAW_TRACEPOINT_OPEN:
|
|
bpf_probe_read_user_str(tp_name, sizeof(tp_name) - 1,
|
|
(void *)attr->raw_tracepoint.name);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
SEC("raw_tracepoint")
|
|
int BPF_PROG(raw_tp_run)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
char _license[] SEC("license") = "GPL";
|