OSDN Git Service

bpf: add writable context for raw tracepoints
authorMatt Mullins <mmullins@fb.com>
Fri, 26 Apr 2019 18:49:47 +0000 (11:49 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 27 Apr 2019 02:04:19 +0000 (19:04 -0700)
commit9df1c28bb75217b244257152ab7d788bb2a386d0
tree7fe10ffd9b59716b52b992f5663ec8b5102406b6
parent34b8ab091f9ef57a2bb3c8c8359a0a03a8abf2f9
bpf: add writable context for raw tracepoints

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>
include/linux/bpf.h
include/linux/bpf_types.h
include/linux/tracepoint-defs.h
include/trace/bpf_probe.h
include/uapi/linux/bpf.h
kernel/bpf/syscall.c
kernel/bpf/verifier.c
kernel/trace/bpf_trace.c