[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170510.150947.1771591614496655880.davem@davemloft.net>
Date: Wed, 10 May 2017 15:09:47 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: ast@...com
CC: alexei.starovoitov@...il.com, daniel@...earbox.net,
netdev@...r.kernel.org
Subject: [PATCH 2/5] 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@...emloft.net>
---
kernel/bpf/verifier.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 56230ff..e1effce 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2932,8 +2932,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;
}
--
2.1.2.532.g19b5d50
Powered by blists - more mailing lists