mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-13 07:56:47 +07:00
9df1c28bb7
This is an opt-in interface that allows a tracepoint to provide a safe buffer that can be written from a BPF_PROG_TYPE_RAW_TRACEPOINT program. The size of the buffer must be a compile-time constant, and is checked before allowing a BPF program to attach to a tracepoint that uses this feature. The pointer to this buffer will be the first argument of tracepoints that opt in; the pointer is valid and can be bpf_probe_read() by both BPF_PROG_TYPE_RAW_TRACEPOINT and BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE programs that attach to such a tracepoint, but the buffer to which it points may only be written by the latter. Signed-off-by: Matt Mullins <mmullins@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
52 lines
1.0 KiB
C
52 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef TRACEPOINT_DEFS_H
|
|
#define TRACEPOINT_DEFS_H 1
|
|
|
|
/*
|
|
* File can be included directly by headers who only want to access
|
|
* tracepoint->key to guard out of line trace calls, or the definition of
|
|
* trace_print_flags{_u64}. Otherwise linux/tracepoint.h should be used.
|
|
*/
|
|
|
|
#include <linux/atomic.h>
|
|
#include <linux/static_key.h>
|
|
|
|
struct trace_print_flags {
|
|
unsigned long mask;
|
|
const char *name;
|
|
};
|
|
|
|
struct trace_print_flags_u64 {
|
|
unsigned long long mask;
|
|
const char *name;
|
|
};
|
|
|
|
struct tracepoint_func {
|
|
void *func;
|
|
void *data;
|
|
int prio;
|
|
};
|
|
|
|
struct tracepoint {
|
|
const char *name; /* Tracepoint name */
|
|
struct static_key key;
|
|
int (*regfunc)(void);
|
|
void (*unregfunc)(void);
|
|
struct tracepoint_func __rcu *funcs;
|
|
};
|
|
|
|
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
|
typedef const int tracepoint_ptr_t;
|
|
#else
|
|
typedef struct tracepoint * const tracepoint_ptr_t;
|
|
#endif
|
|
|
|
struct bpf_raw_event_map {
|
|
struct tracepoint *tp;
|
|
void *bpf_func;
|
|
u32 num_args;
|
|
u32 writable_size;
|
|
} __aligned(32);
|
|
|
|
#endif
|