]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bpf: Fix preempt_enable_no_resched() abuse
authorPeter Zijlstra <peterz@infradead.org>
Tue, 23 Apr 2019 19:55:59 +0000 (21:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2019 16:22:28 +0000 (18:22 +0200)
[ Upstream commit 0edd6b64d1939e9e9168ff27947995bb7751db5d ]

Unless the very next line is schedule(), or implies it, one must not use
preempt_enable_no_resched(). It can cause a preemption to go missing and
thereby cause arbitrary delays, breaking the PREEMPT=y invariant.

Cc: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/bpf.h

index e734f163bd0b9ae05c199fde7bd4e3dc1bfed542..1fbd7672e4b37700429bf9dc7364a8d475b02cb9 100644 (file)
@@ -455,7 +455,7 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
                }                                       \
 _out:                                                  \
                rcu_read_unlock();                      \
-               preempt_enable_no_resched();            \
+               preempt_enable();                       \
                _ret;                                   \
         })