Message ID | 20231022010812.9201-8-eddyz87@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | exact states comparison for iterator convergence checks | expand |
On Sat, Oct 21, 2023 at 6:08 PM Eduard Zingerman <eddyz87@gmail.com> wrote: > > Additional logging in is_state_visited(): if infinite loop is detected > print full verifier state for both current and equivalent states. > > Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> > --- > kernel/bpf/verifier.c | 4 ++++ > 1 file changed, 4 insertions(+) > Great, thanks! Acked-by: Andrii Nakryiko <andrii@kernel.org> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index baf31b61b3ff..a91aa8638dba 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -16927,6 +16927,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 > -- > 2.42.0 >
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index baf31b61b3ff..a91aa8638dba 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -16927,6 +16927,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
Additional logging in is_state_visited(): if infinite loop is detected print full verifier state for both current and equivalent states. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> --- kernel/bpf/verifier.c | 4 ++++ 1 file changed, 4 insertions(+)