Skip to content

Commit 0f08ebc

Browse files
eddyz87Sasha Levin
authored andcommitted
bpf: abort verification if env->cur_state->loop_entry != NULL
[ Upstream commit f3c2d24 ] 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 <[email protected]> Signed-off-by: Eduard Zingerman <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9d027e0 commit 0f08ebc

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
@@ -19265,8 +19265,10 @@ static int do_check(struct bpf_verifier_env *env)
1926519265
return err;
1926619266
break;
1926719267
} else {
19268-
if (WARN_ON_ONCE(env->cur_state->loop_entry))
19269-
env->cur_state->loop_entry = NULL;
19268+
if (WARN_ON_ONCE(env->cur_state->loop_entry)) {
19269+
verbose(env, "verifier bug: env->cur_state->loop_entry != NULL\n");
19270+
return -EFAULT;
19271+
}
1927019272
do_print_state = true;
1927119273
continue;
1927219274
}

0 commit comments

Comments
 (0)