[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170511.120529.492579439081538459.davem@davemloft.net>
Date: Thu, 11 May 2017 12:05:29 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: daniel@...earbox.net
CC: ast@...com, alexei.starovoitov@...il.com, netdev@...r.kernel.org
Subject: [PATCH v2 2/7] 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 cc7b626..ff2bfe1 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;
}
--
2.7.4
Powered by blists - more mailing lists