]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/bpf-fix-preempt_enable_no_resched-abuse.patch
Linux 5.0.19
[thirdparty/kernel/stable-queue.git] / queue-4.19 / bpf-fix-preempt_enable_no_resched-abuse.patch
1 From df6f03a6d7b7bff9a695fed7530c1bed0ec29611 Mon Sep 17 00:00:00 2001
2 From: Peter Zijlstra <peterz@infradead.org>
3 Date: Tue, 23 Apr 2019 21:55:59 +0200
4 Subject: bpf: Fix preempt_enable_no_resched() abuse
5
6 [ Upstream commit 0edd6b64d1939e9e9168ff27947995bb7751db5d ]
7
8 Unless the very next line is schedule(), or implies it, one must not use
9 preempt_enable_no_resched(). It can cause a preemption to go missing and
10 thereby cause arbitrary delays, breaking the PREEMPT=y invariant.
11
12 Cc: Roman Gushchin <guro@fb.com>
13 Cc: Alexei Starovoitov <ast@kernel.org>
14 Cc: Daniel Borkmann <daniel@iogearbox.net>
15 Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
16 Signed-off-by: Alexei Starovoitov <ast@kernel.org>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 include/linux/bpf.h | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22 diff --git a/include/linux/bpf.h b/include/linux/bpf.h
23 index 523481a3471b5..fd95f2efe5f32 100644
24 --- a/include/linux/bpf.h
25 +++ b/include/linux/bpf.h
26 @@ -400,7 +400,7 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
27 } \
28 _out: \
29 rcu_read_unlock(); \
30 - preempt_enable_no_resched(); \
31 + preempt_enable(); \
32 _ret; \
33 })
34
35 --
36 2.20.1
37