diff options
author | Matt Mullins <mmullins@fb.com> | 2019-04-26 14:49:47 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-04-26 22:04:19 -0400 |
commit | 9df1c28bb75217b244257152ab7d788bb2a386d0 (patch) | |
tree | 7fe10ffd9b59716b52b992f5663ec8b5102406b6 /include/linux/bpf.h | |
parent | 34b8ab091f9ef57a2bb3c8c8359a0a03a8abf2f9 (diff) |
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>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r-- | include/linux/bpf.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index f15432d90728..cd6341eabd74 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
@@ -272,6 +272,7 @@ enum bpf_reg_type { | |||
272 | PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */ | 272 | PTR_TO_SOCK_COMMON_OR_NULL, /* reg points to sock_common or NULL */ |
273 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ | 273 | PTR_TO_TCP_SOCK, /* reg points to struct tcp_sock */ |
274 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ | 274 | PTR_TO_TCP_SOCK_OR_NULL, /* reg points to struct tcp_sock or NULL */ |
275 | PTR_TO_TP_BUFFER, /* reg points to a writable raw tp's buffer */ | ||
275 | }; | 276 | }; |
276 | 277 | ||
277 | /* The information passed from prog-specific *_is_valid_access | 278 | /* The information passed from prog-specific *_is_valid_access |
@@ -361,6 +362,7 @@ struct bpf_prog_aux { | |||
361 | u32 used_map_cnt; | 362 | u32 used_map_cnt; |
362 | u32 max_ctx_offset; | 363 | u32 max_ctx_offset; |
363 | u32 max_pkt_offset; | 364 | u32 max_pkt_offset; |
365 | u32 max_tp_access; | ||
364 | u32 stack_depth; | 366 | u32 stack_depth; |
365 | u32 id; | 367 | u32 id; |
366 | u32 func_cnt; /* used by non-func prog as the number of func progs */ | 368 | u32 func_cnt; /* used by non-func prog as the number of func progs */ |