summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@redhat.com>2020-09-25 23:25:01 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-09-28 17:09:59 -0700
commitefc68158c429f37d87fd02ee9a26913c78546fc9 (patch)
treedbff90d25f49eb38e278dc0edc000c6e0a72d43a /include
parent1af9270e908cd50a4f5d815c9b6f794c7d57ed07 (diff)
downloadlinux-stable-efc68158c429f37d87fd02ee9a26913c78546fc9.tar.gz
linux-stable-efc68158c429f37d87fd02ee9a26913c78546fc9.tar.bz2
linux-stable-efc68158c429f37d87fd02ee9a26913c78546fc9.zip
bpf: change logging calls from verbose() to bpf_log() and use log pointer
In preparation for moving code around, change a bunch of references to env->log (and the verbose() logging helper) to use bpf_log() and a direct pointer to struct bpf_verifier_log. While we're touching the function signature, mark the 'prog' argument to bpf_check_type_match() as const. Also enhance the bpf_verifier_log_needed() check to handle NULL pointers for the log struct so we can re-use the code with logging disabled. Acked-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bpf.h2
-rw-r--r--include/linux/bpf_verifier.h5
2 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index db6dcdee7933..5176726f4f03 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1420,7 +1420,7 @@ int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog,
struct bpf_reg_state *regs);
int btf_prepare_func_args(struct bpf_verifier_env *env, int subprog,
struct bpf_reg_state *reg);
-int btf_check_type_match(struct bpf_verifier_env *env, struct bpf_prog *prog,
+int btf_check_type_match(struct bpf_verifier_log *log, const struct bpf_prog *prog,
struct btf *btf, const struct btf_type *t);
struct bpf_prog *bpf_prog_by_id(u32 id);
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 2bb48a2c4d08..7bc9276c4ef4 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -347,8 +347,9 @@ static inline bool bpf_verifier_log_full(const struct bpf_verifier_log *log)
static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log)
{
- return (log->level && log->ubuf && !bpf_verifier_log_full(log)) ||
- log->level == BPF_LOG_KERNEL;
+ return log &&
+ ((log->level && log->ubuf && !bpf_verifier_log_full(log)) ||
+ log->level == BPF_LOG_KERNEL);
}
#define BPF_MAX_SUBPROGS 256