diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bpf.h | 2 | ||||
-rw-r--r-- | include/linux/bpf_types.h | 1 | ||||
-rw-r--r-- | include/linux/tracepoint-defs.h | 1 | ||||
-rw-r--r-- | include/trace/bpf_probe.h | 27 | ||||
-rw-r--r-- | include/uapi/linux/bpf.h | 1 |
5 files changed, 30 insertions, 2 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 */ |
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index d26991a16894..a10d37bce364 100644 --- a/include/linux/bpf_types.h +++ b/include/linux/bpf_types.h | |||
@@ -25,6 +25,7 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_KPROBE, kprobe) | |||
25 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) | 25 | BPF_PROG_TYPE(BPF_PROG_TYPE_TRACEPOINT, tracepoint) |
26 | BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) | 26 | BPF_PROG_TYPE(BPF_PROG_TYPE_PERF_EVENT, perf_event) |
27 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) | 27 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint) |
28 | BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, raw_tracepoint_writable) | ||
28 | #endif | 29 | #endif |
29 | #ifdef CONFIG_CGROUP_BPF | 30 | #ifdef CONFIG_CGROUP_BPF |
30 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) | 31 | BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) |
diff --git a/include/linux/tracepoint-defs.h b/include/linux/tracepoint-defs.h index 49ba9cde7e4b..b29950a19205 100644 --- a/include/linux/tracepoint-defs.h +++ b/include/linux/tracepoint-defs.h | |||
@@ -45,6 +45,7 @@ struct bpf_raw_event_map { | |||
45 | struct tracepoint *tp; | 45 | struct tracepoint *tp; |
46 | void *bpf_func; | 46 | void *bpf_func; |
47 | u32 num_args; | 47 | u32 num_args; |
48 | u32 writable_size; | ||
48 | } __aligned(32); | 49 | } __aligned(32); |
49 | 50 | ||
50 | #endif | 51 | #endif |
diff --git a/include/trace/bpf_probe.h b/include/trace/bpf_probe.h index 505dae0bed80..d6e556c0a085 100644 --- a/include/trace/bpf_probe.h +++ b/include/trace/bpf_probe.h | |||
@@ -69,8 +69,7 @@ __bpf_trace_##call(void *__data, proto) \ | |||
69 | * to make sure that if the tracepoint handling changes, the | 69 | * to make sure that if the tracepoint handling changes, the |
70 | * bpf probe will fail to compile unless it too is updated. | 70 | * bpf probe will fail to compile unless it too is updated. |
71 | */ | 71 | */ |
72 | #undef DEFINE_EVENT | 72 | #define __DEFINE_EVENT(template, call, proto, args, size) \ |
73 | #define DEFINE_EVENT(template, call, proto, args) \ | ||
74 | static inline void bpf_test_probe_##call(void) \ | 73 | static inline void bpf_test_probe_##call(void) \ |
75 | { \ | 74 | { \ |
76 | check_trace_callback_type_##call(__bpf_trace_##template); \ | 75 | check_trace_callback_type_##call(__bpf_trace_##template); \ |
@@ -81,12 +80,36 @@ __bpf_trace_tp_map_##call = { \ | |||
81 | .tp = &__tracepoint_##call, \ | 80 | .tp = &__tracepoint_##call, \ |
82 | .bpf_func = (void *)__bpf_trace_##template, \ | 81 | .bpf_func = (void *)__bpf_trace_##template, \ |
83 | .num_args = COUNT_ARGS(args), \ | 82 | .num_args = COUNT_ARGS(args), \ |
83 | .writable_size = size, \ | ||
84 | }; | 84 | }; |
85 | 85 | ||
86 | #define FIRST(x, ...) x | ||
87 | |||
88 | #undef DEFINE_EVENT_WRITABLE | ||
89 | #define DEFINE_EVENT_WRITABLE(template, call, proto, args, size) \ | ||
90 | static inline void bpf_test_buffer_##call(void) \ | ||
91 | { \ | ||
92 | /* BUILD_BUG_ON() is ignored if the code is completely eliminated, but \ | ||
93 | * BUILD_BUG_ON_ZERO() uses a different mechanism that is not \ | ||
94 | * dead-code-eliminated. \ | ||
95 | */ \ | ||
96 | FIRST(proto); \ | ||
97 | (void)BUILD_BUG_ON_ZERO(size != sizeof(*FIRST(args))); \ | ||
98 | } \ | ||
99 | __DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args), size) | ||
100 | |||
101 | #undef DEFINE_EVENT | ||
102 | #define DEFINE_EVENT(template, call, proto, args) \ | ||
103 | __DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args), 0) | ||
86 | 104 | ||
87 | #undef DEFINE_EVENT_PRINT | 105 | #undef DEFINE_EVENT_PRINT |
88 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 106 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
89 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | 107 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |
90 | 108 | ||
91 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 109 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
110 | |||
111 | #undef DEFINE_EVENT_WRITABLE | ||
112 | #undef __DEFINE_EVENT | ||
113 | #undef FIRST | ||
114 | |||
92 | #endif /* CONFIG_BPF_EVENTS */ | 115 | #endif /* CONFIG_BPF_EVENTS */ |
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index eaf2d3284248..f7fa7a34a62d 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
@@ -168,6 +168,7 @@ enum bpf_prog_type { | |||
168 | BPF_PROG_TYPE_SK_REUSEPORT, | 168 | BPF_PROG_TYPE_SK_REUSEPORT, |
169 | BPF_PROG_TYPE_FLOW_DISSECTOR, | 169 | BPF_PROG_TYPE_FLOW_DISSECTOR, |
170 | BPF_PROG_TYPE_CGROUP_SYSCTL, | 170 | BPF_PROG_TYPE_CGROUP_SYSCTL, |
171 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, | ||
171 | }; | 172 | }; |
172 | 173 | ||
173 | enum bpf_attach_type { | 174 | enum bpf_attach_type { |