]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0125-locking-barriers-Add-implicit-smp_read_barrier_depen.patch
5f498358bb36da726b4c947264d06712edcce430
[pve-kernel.git] / patches / kernel / 0125-locking-barriers-Add-implicit-smp_read_barrier_depen.patch
1 From 8b7859c0d35e5047d60c5e241fa40104b9c96f39 Mon Sep 17 00:00:00 2001
2 From: Will Deacon <will.deacon@arm.com>
3 Date: Tue, 24 Oct 2017 11:22:47 +0100
4 Subject: [PATCH 125/233] locking/barriers: Add implicit
5 smp_read_barrier_depends() to READ_ONCE()
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 CVE-2017-5754
11
12 [ Note, this is a Git cherry-pick of the following commit:
13
14 76ebbe78f739 ("locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()")
15
16 ... for easier x86 PTI code testing and back-porting. ]
17
18 In preparation for the removal of lockless_dereference(), which is the
19 same as READ_ONCE() on all architectures other than Alpha, add an
20 implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
21 used to head dependency chains on all architectures.
22
23 Signed-off-by: Will Deacon <will.deacon@arm.com>
24 Cc: Linus Torvalds <torvalds@linux-foundation.org>
25 Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
26 Cc: Peter Zijlstra <peterz@infradead.org>
27 Cc: Thomas Gleixner <tglx@linutronix.de>
28 Link: http://lkml.kernel.org/r/1508840570-22169-3-git-send-email-will.deacon@arm.com
29 Signed-off-by: Ingo Molnar <mingo@kernel.org>
30 (cherry picked from commit c2bc66082e1048c7573d72e62f597bdc5ce13fea)
31 Signed-off-by: Andy Whitcroft <apw@canonical.com>
32 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
33 (cherry picked from commit 6ef3d843f8f1a8b72ca83d4b1d457c2896278ccd)
34 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
35 ---
36 include/linux/compiler.h | 1 +
37 1 file changed, 1 insertion(+)
38
39 diff --git a/include/linux/compiler.h b/include/linux/compiler.h
40 index 043b60de041e..8af8814ebe7a 100644
41 --- a/include/linux/compiler.h
42 +++ b/include/linux/compiler.h
43 @@ -314,6 +314,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
44 __read_once_size(&(x), __u.__c, sizeof(x)); \
45 else \
46 __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
47 + smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \
48 __u.__val; \
49 })
50 #define READ_ONCE(x) __READ_ONCE(x, 1)
51 --
52 2.14.2
53