diff options
author | Alexei Starovoitov <ast@kernel.org> | 2019-02-21 13:40:14 -0500 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-02-21 18:14:19 -0500 |
commit | e80d02dd763093f70c3000ef34253a6d426becf6 (patch) | |
tree | b6484e87e9077adc485a55d7a2baf92640dd9660 | |
parent | 74e31ca850c1cddeca03503171dd145b6ce293b6 (diff) |
seccomp, bpf: disable preemption before calling into bpf prog
All BPF programs must be called with preemption disabled.
Fixes: 568f196756ad ("bpf: check that BPF programs run with preemption disabled")
Reported-by: syzbot+8bf19ee2aa580de7a2a7@syzkaller.appspotmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | kernel/seccomp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index e815781ed751..a43c601ac252 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c | |||
@@ -267,6 +267,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd, | |||
267 | * All filters in the list are evaluated and the lowest BPF return | 267 | * All filters in the list are evaluated and the lowest BPF return |
268 | * value always takes priority (ignoring the DATA). | 268 | * value always takes priority (ignoring the DATA). |
269 | */ | 269 | */ |
270 | preempt_disable(); | ||
270 | for (; f; f = f->prev) { | 271 | for (; f; f = f->prev) { |
271 | u32 cur_ret = BPF_PROG_RUN(f->prog, sd); | 272 | u32 cur_ret = BPF_PROG_RUN(f->prog, sd); |
272 | 273 | ||
@@ -275,6 +276,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd, | |||
275 | *match = f; | 276 | *match = f; |
276 | } | 277 | } |
277 | } | 278 | } |
279 | preempt_enable(); | ||
278 | return ret; | 280 | return ret; |
279 | } | 281 | } |
280 | #endif /* CONFIG_SECCOMP_FILTER */ | 282 | #endif /* CONFIG_SECCOMP_FILTER */ |