Skip to content

Commit f3c2d24

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
bpf: abort verification if env->cur_state->loop_entry != NULL
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]>
1 parent 1ffe30e commit f3c2d24

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
@@ -19340,8 +19340,10 @@ static int do_check(struct bpf_verifier_env *env)
1934019340
return err;
1934119341
break;
1934219342
} else {
19343-
if (WARN_ON_ONCE(env->cur_state->loop_entry))
19344-
env->cur_state->loop_entry = NULL;
19343+
if (WARN_ON_ONCE(env->cur_state->loop_entry)) {
19344+
verbose(env, "verifier bug: env->cur_state->loop_entry != NULL\n");
19345+
return -EFAULT;
19346+
}
1934519347
do_print_state = true;
1934619348
continue;
1934719349
}

0 commit comments

Comments
 (0)