]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0177-x86-mm-Remove-superfluous-barriers.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0177-x86-mm-Remove-superfluous-barriers.patch
CommitLineData
321d628a
FG
1From bf670c55337b76ab2449abe15d3fd3c11b14c013 Mon Sep 17 00:00:00 2001
2From: Peter Zijlstra <peterz@infradead.org>
3Date: Tue, 5 Dec 2017 13:34:46 +0100
e4cdf2a5 4Subject: [PATCH 177/241] x86/mm: Remove superfluous barriers
321d628a
FG
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9CVE-2017-5754
10
11atomic64_inc_return() already implies smp_mb() before and after.
12
13Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
14Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
15Cc: Andy Lutomirski <luto@kernel.org>
16Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
17Cc: Borislav Petkov <bp@alien8.de>
18Cc: Brian Gerst <brgerst@gmail.com>
19Cc: Dave Hansen <dave.hansen@linux.intel.com>
20Cc: David Laight <David.Laight@aculab.com>
21Cc: Denys Vlasenko <dvlasenk@redhat.com>
22Cc: Eduardo Valentin <eduval@amazon.com>
23Cc: Greg KH <gregkh@linuxfoundation.org>
24Cc: H. Peter Anvin <hpa@zytor.com>
25Cc: Josh Poimboeuf <jpoimboe@redhat.com>
26Cc: Juergen Gross <jgross@suse.com>
27Cc: Linus Torvalds <torvalds@linux-foundation.org>
28Cc: Peter Zijlstra <peterz@infradead.org>
29Cc: Will Deacon <will.deacon@arm.com>
30Cc: aliguori@amazon.com
31Cc: daniel.gruss@iaik.tugraz.at
32Cc: hughd@google.com
33Cc: keescook@google.com
34Cc: linux-mm@kvack.org
35Signed-off-by: Ingo Molnar <mingo@kernel.org>
36(cherry picked from commit b5fc6d943808b570bdfbec80f40c6b3855f1c48b)
37Signed-off-by: Andy Whitcroft <apw@canonical.com>
38Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
39(cherry picked from commit 31a37930df33315a7006b46706f6babdb57db1f4)
40Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
41---
42 arch/x86/include/asm/tlbflush.h | 8 +-------
43 1 file changed, 1 insertion(+), 7 deletions(-)
44
45diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
46index 6d2688a6fda0..bc1460b4737b 100644
47--- a/arch/x86/include/asm/tlbflush.h
48+++ b/arch/x86/include/asm/tlbflush.h
49@@ -59,19 +59,13 @@ static inline void invpcid_flush_all_nonglobals(void)
50
51 static inline u64 inc_mm_tlb_gen(struct mm_struct *mm)
52 {
53- u64 new_tlb_gen;
54-
55 /*
56 * Bump the generation count. This also serves as a full barrier
57 * that synchronizes with switch_mm(): callers are required to order
58 * their read of mm_cpumask after their writes to the paging
59 * structures.
60 */
61- smp_mb__before_atomic();
62- new_tlb_gen = atomic64_inc_return(&mm->context.tlb_gen);
63- smp_mb__after_atomic();
64-
65- return new_tlb_gen;
66+ return atomic64_inc_return(&mm->context.tlb_gen);
67 }
68
69 #ifdef CONFIG_PARAVIRT
70--
712.14.2
72