Skip to content

Commit c349480

Browse files
Alexei Starovoitovborkmann
authored andcommitted
bpf: check pending signals while verifying programs
Malicious user space may try to force the verifier to use as much cpu time and memory as possible. Hence check for pending signals while verifying the program. Note that suspend of sys_bpf(PROG_LOAD) syscall will lead to EAGAIN, since the kernel has to release the resources used for program verification. Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Edward Cree <ecree@solarflare.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 025dceb commit c349480

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎kernel/bpf/verifier.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5148,6 +5148,9 @@ static int do_check(struct bpf_verifier_env *env)
51485148
goto process_bpf_exit;
51495149
}
51505150

5151+
if (signal_pending(current))
5152+
return -EAGAIN;
5153+
51515154
if (need_resched())
51525155
cond_resched();
51535156

0 commit comments

Comments
 (0)