aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/bpf_verifier.h3
-rw-r--r--kernel/bpf/verifier.c16
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
195static inline struct bpf_reg_state *cur_regs(struct bpf_verifier_env *env) 198static 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 {
169static DEFINE_MUTEX(bpf_verifier_lock); 169static 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 */
175static __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}
200EXPORT_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 */
205static __printf(2, 3) void verbose(struct bpf_verifier_env *env,
206 const char *fmt, ...)
207 __attribute__((alias("bpf_verifier_log_write")));
200 208
201static bool type_is_pkt_pointer(enum bpf_reg_type type) 209static bool type_is_pkt_pointer(enum bpf_reg_type type)
202{ 210{