diff options
author | Eduard Zingerman <eddyz87@gmail.com> | 2023-10-24 03:09:17 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-10-23 21:49:32 -0700 |
commit | b4d8239534fddc036abe4a0fdbf474d9894d4641 (patch) | |
tree | 3dc1fcf7ed24072d47e2cab602fda5476f7171b7 /kernel/bpf | |
parent | 64870feebecb7130291a55caf0ce839a87405a70 (diff) |
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>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/verifier.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index f23fbfe82c59..98f9d0f35931 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -16928,6 +16928,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 |