Skip to content

Commit 80eb737

Browse files
eddyz87gregkh
authored andcommitted
bpf: abort verification if env->cur_state->loop_entry != NULL
commit f3c2d24 upstream. In addition to warning abort verification with -EFAULT. If env->cur_state->loop_entry != NULL something is irrecoverably buggy. Fixes: bbbc02b ("bpf: copy_verifier_state() should copy 'loop_entry' field") Suggested-by: Andrii Nakryiko <andrii.nakryiko@gmail.com> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20250225003838.135319-1-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fdee1dc commit 80eb737

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/bpf/verifier.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18721,8 +18721,10 @@ static int do_check(struct bpf_verifier_env *env)
1872118721
return err;
1872218722
break;
1872318723
} else {
18724-
if (WARN_ON_ONCE(env->cur_state->loop_entry))
18725-
env->cur_state->loop_entry = NULL;
18724+
if (WARN_ON_ONCE(env->cur_state->loop_entry)) {
18725+
verbose(env, "verifier bug: env->cur_state->loop_entry != NULL\n");
18726+
return -EFAULT;
18727+
}
1872618728
do_print_state = true;
1872718729
continue;
1872818730
}

0 commit comments

Comments
 (0)