Skip to content

Commit e80d02d

Browse files
Alexei Starovoitovborkmann
authored andcommitted
seccomp, bpf: disable preemption before calling into bpf prog
All BPF programs must be called with preemption disabled. Fixes: 568f196 ("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>
1 parent 74e31ca commit e80d02d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/seccomp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
267267
* All filters in the list are evaluated and the lowest BPF return
268268
* value always takes priority (ignoring the DATA).
269269
*/
270+
preempt_disable();
270271
for (; f; f = f->prev) {
271272
u32 cur_ret = BPF_PROG_RUN(f->prog, sd);
272273

@@ -275,6 +276,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
275276
*match = f;
276277
}
277278
}
279+
preempt_enable();
278280
return ret;
279281
}
280282
#endif /* CONFIG_SECCOMP_FILTER */

0 commit comments

Comments
 (0)