diff options
| author | Daniel Borkmann <daniel@iogearbox.net> | 2018-03-26 10:58:18 +0300 |
|---|---|---|
| committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-03-26 10:58:18 +0300 |
| commit | 2abb5fad3a9336ea02bf832175b9e4fd5b946e47 (patch) | |
| tree | dab2d5beef6275329e8ed3dbaff7f720d6f05f6c /include | |
| parent | 639a53da7c8cea7e476fed5e9ce6b1fa1bcce05a (diff) | |
| parent | 77d2e05abd45886dcad2b632c738cf46b9f7c19e (diff) | |
| download | linux-2abb5fad3a9336ea02bf832175b9e4fd5b946e47.tar.xz | |
Merge branch 'bpf-verifier-log-btf-prep'
Martin KaFai Lau says:
====================
This patch set has some changes and clean-up works for
the bpf_verifier_log. They are the prep works for the
BTF (BPF Type Format).
====================
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bpf_verifier.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 6b66cd1aa0b9..7e61c395fddf 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -153,7 +153,7 @@ struct bpf_insn_aux_data { #define BPF_VERIFIER_TMP_LOG_SIZE 1024 -struct bpf_verifer_log { +struct bpf_verifier_log { u32 level; char kbuf[BPF_VERIFIER_TMP_LOG_SIZE]; char __user *ubuf; @@ -161,11 +161,16 @@ struct bpf_verifer_log { u32 len_total; }; -static inline bool bpf_verifier_log_full(const struct bpf_verifer_log *log) +static inline bool bpf_verifier_log_full(const struct bpf_verifier_log *log) { return log->len_used >= log->len_total - 1; } +static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log) +{ + return log->level && log->ubuf && !bpf_verifier_log_full(log); +} + #define BPF_MAX_SUBPROGS 256 /* single container for all structs @@ -185,13 +190,15 @@ struct bpf_verifier_env { bool allow_ptr_leaks; bool seen_direct_write; struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */ - struct bpf_verifer_log log; + struct bpf_verifier_log log; u32 subprog_starts[BPF_MAX_SUBPROGS]; /* computes the stack depth of each bpf function */ u16 subprog_stack_depth[BPF_MAX_SUBPROGS + 1]; u32 subprog_cnt; }; +void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt, + va_list args); __printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, const char *fmt, ...); |
