Skip to content

Commit b4d8239

Browse files
eddyz87Alexei Starovoitov
authored and
Alexei Starovoitov
committed
bpf: print full verifier states on infinite loop detection
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 <andrii@kernel.org> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20231024000917.12153-8-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 64870fe commit b4d8239

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16928,6 +16928,10 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
1692816928
!iter_active_depths_differ(&sl->state, cur)) {
1692916929
verbose_linfo(env, insn_idx, "; ");
1693016930
verbose(env, "infinite loop detected at insn %d\n", insn_idx);
16931+
verbose(env, "cur state:");
16932+
print_verifier_state(env, cur->frame[cur->curframe], true);
16933+
verbose(env, "old state:");
16934+
print_verifier_state(env, sl->state.frame[cur->curframe], true);
1693116935
return -EINVAL;
1693216936
}
1693316937
/* if the verifier is processing a loop, avoid adding new state

0 commit comments

Comments
 (0)