Skip to content

Commit 6ffd9f2

Browse files
Alexei Starovoitovgregkh
authored andcommitted
bpf: check pending signals while verifying programs
[ Upstream commit c349480 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent efda3b1 commit 6ffd9f2

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
@@ -4792,6 +4792,9 @@ static int do_check(struct bpf_verifier_env *env)
47924792
goto process_bpf_exit;
47934793
}
47944794

4795+
if (signal_pending(current))
4796+
return -EAGAIN;
4797+
47954798
if (need_resched())
47964799
cond_resched();
47974800

0 commit comments

Comments
 (0)