diff options
-rw-r--r-- | include/linux/bpf_verifier.h | 3 | ||||
-rw-r--r-- | kernel/bpf/verifier.c | 16 |
2 files changed, 15 insertions, 4 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 2feb218c001d..6b66cd1aa0b9 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h | |||
@@ -192,6 +192,9 @@ struct bpf_verifier_env { | |||
192 | u32 subprog_cnt; | 192 | u32 subprog_cnt; |
193 | }; | 193 | }; |
194 | 194 | ||
195 | __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, | ||
196 | const char *fmt, ...); | ||
197 | |||
195 | static inline struct bpf_reg_state *cur_regs(struct bpf_verifier_env *env) | 198 | static inline struct bpf_reg_state *cur_regs(struct bpf_verifier_env *env) |
196 | { | 199 | { |
197 | struct bpf_verifier_state *cur = env->cur_state; | 200 | struct bpf_verifier_state *cur = env->cur_state; |
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index d921ab387b0b..3b2b47666180 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
@@ -169,11 +169,11 @@ struct bpf_call_arg_meta { | |||
169 | static DEFINE_MUTEX(bpf_verifier_lock); | 169 | static DEFINE_MUTEX(bpf_verifier_lock); |
170 | 170 | ||
171 | /* log_level controls verbosity level of eBPF verifier. | 171 | /* log_level controls verbosity level of eBPF verifier. |
172 | * verbose() is used to dump the verification trace to the log, so the user | 172 | * bpf_verifier_log_write() is used to dump the verification trace to the log, |
173 | * can figure out what's wrong with the program | 173 | * so the user can figure out what's wrong with the program |
174 | */ | 174 | */ |
175 | static __printf(2, 3) void verbose(struct bpf_verifier_env *env, | 175 | __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, |
176 | const char *fmt, ...) | 176 | const char *fmt, ...) |
177 | { | 177 | { |
178 | struct bpf_verifer_log *log = &env->log; | 178 | struct bpf_verifer_log *log = &env->log; |
179 | unsigned int n; | 179 | unsigned int n; |
@@ -197,6 +197,14 @@ static __printf(2, 3) void verbose(struct bpf_verifier_env *env, | |||
197 | else | 197 | else |
198 | log->ubuf = NULL; | 198 | log->ubuf = NULL; |
199 | } | 199 | } |
200 | EXPORT_SYMBOL_GPL(bpf_verifier_log_write); | ||
201 | /* Historically bpf_verifier_log_write was called verbose, but the name was too | ||
202 | * generic for symbol export. The function was renamed, but not the calls in | ||
203 | * the verifier to avoid complicating backports. Hence the alias below. | ||
204 | */ | ||
205 | static __printf(2, 3) void verbose(struct bpf_verifier_env *env, | ||
206 | const char *fmt, ...) | ||
207 | __attribute__((alias("bpf_verifier_log_write"))); | ||
200 | 208 | ||
201 | static bool type_is_pkt_pointer(enum bpf_reg_type type) | 209 | static bool type_is_pkt_pointer(enum bpf_reg_type type) |
202 | { | 210 | { |