Commit c5fc9692 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent d1174416
...@@ -2926,8 +2926,12 @@ static int do_check(struct bpf_verifier_env *env) ...@@ -2926,8 +2926,12 @@ static int do_check(struct bpf_verifier_env *env)
goto process_bpf_exit; goto process_bpf_exit;
} }
if (log_level && do_print_state) { if (log_level > 1 || (log_level && do_print_state)) {
verbose("\nfrom %d to %d:", prev_insn_idx, insn_idx); 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); print_verifier_state(&env->cur_state);
do_print_state = false; do_print_state = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment