From: Eduard Zingerman Date: Tue, 24 Oct 2023 00:09:17 +0000 (+0300) Subject: bpf: print full verifier states on infinite loop detection X-Git-Tag: v6.6.17~632 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae5e9c3ced95aafc8a3fed56eac9553ffc64f007;p=platform%2Fkernel%2Flinux-rpi.git bpf: print full verifier states on infinite loop detection commit b4d8239534fddc036abe4a0fdbf474d9894d4641 upstream. Additional logging in is_state_visited(): if infinite loop is detected print full verifier state for both current and equivalent states. Acked-by: Andrii Nakryiko Signed-off-by: Eduard Zingerman Link: https://lore.kernel.org/r/20231024000917.12153-8-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index bf0f032..9a30d73 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -16540,6 +16540,10 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx) !iter_active_depths_differ(&sl->state, cur)) { verbose_linfo(env, insn_idx, "; "); verbose(env, "infinite loop detected at insn %d\n", insn_idx); + verbose(env, "cur state:"); + print_verifier_state(env, cur->frame[cur->curframe], true); + verbose(env, "old state:"); + print_verifier_state(env, sl->state.frame[cur->curframe], true); return -EINVAL; } /* if the verifier is processing a loop, avoid adding new state