summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlexei Starovoitov2018-12-04 07:46:04 +0100
committerGreg Kroah-Hartman2018-12-21 14:15:21 +0100
commit6ffd9f25c0e957ade0afb0a437cfc08cd31deffc (patch)
tree448b0b0618c7b2d3e2b36d781838a66f88e5658b /kernel
parentnet/mlx4_en: Fix build break when CONFIG_INET is off (diff)
downloadkernel-qcow2-linux-6ffd9f25c0e957ade0afb0a437cfc08cd31deffc.tar.gz
kernel-qcow2-linux-6ffd9f25c0e957ade0afb0a437cfc08cd31deffc.tar.xz
kernel-qcow2-linux-6ffd9f25c0e957ade0afb0a437cfc08cd31deffc.zip
bpf: check pending signals while verifying programs
[ Upstream commit c3494801cd1785e2c25f1a5735fa19ddcf9665da ] 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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/verifier.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 56acfbb80104..2954e4b3abd5 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -4792,6 +4792,9 @@ static int do_check(struct bpf_verifier_env *env)
goto process_bpf_exit;
}
+ if (signal_pending(current))
+ return -EAGAIN;
+
if (need_resched())
cond_resched();