All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] bpf: Do per-instruction state dumping in verifier when log_level > 1.
@ 2017-05-10 19:09 David Miller
  2017-05-11 12:42 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2017-05-10 19:09 UTC (permalink / raw)
  To: ast; +Cc: alexei.starovoitov, daniel, netdev


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>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/5] bpf: Do per-instruction state dumping in verifier when log_level > 1.
  2017-05-10 19:09 [PATCH 2/5] bpf: Do per-instruction state dumping in verifier when log_level > 1 David Miller
@ 2017-05-11 12:42 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2017-05-11 12:42 UTC (permalink / raw)
  To: David Miller, ast; +Cc: alexei.starovoitov, netdev

On 05/10/2017 09:09 PM, David Miller wrote:
>
> 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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-11 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 19:09 [PATCH 2/5] bpf: Do per-instruction state dumping in verifier when log_level > 1 David Miller
2017-05-11 12:42 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.