diff options
author | David S. Miller <davem@davemloft.net> | 2017-05-10 11:25:17 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-11 14:19:00 -0400 |
commit | c5fc9692d101d1318b0f53f9f691cd88ac029317 (patch) | |
tree | d1377b940772c2761cb6a723655d56a565586b47 /kernel/bpf | |
parent | d1174416747d790d750742d0514915deeed93acf (diff) | |
download | talos-obmc-linux-c5fc9692d101d1318b0f53f9f691cd88ac029317.tar.gz talos-obmc-linux-c5fc9692d101d1318b0f53f9f691cd88ac029317.zip |
bpf: Do per-instruction state dumping in verifier when log_level > 1.
If log_level > 1, do a state dump every instruction and emit it in
a more compact way (without a leading newline).
This will facilitate more sophisticated test cases which inspect the
verifier log for register state.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/verifier.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index cc7b626fa447..ff2bfe1d656a 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -2926,8 +2926,12 @@ static int do_check(struct bpf_verifier_env *env) goto process_bpf_exit; } - if (log_level && do_print_state) { - verbose("\nfrom %d to %d:", prev_insn_idx, insn_idx); + if (log_level > 1 || (log_level && do_print_state)) { + if (log_level > 1) + verbose("%d:", insn_idx); + else + verbose("\nfrom %d to %d:", + prev_insn_idx, insn_idx); print_verifier_state(&env->cur_state); do_print_state = false; } |