]> git.proxmox.com Git - pve-kernel.git/blob - 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
1 From bf670c55337b76ab2449abe15d3fd3c11b14c013 Mon Sep 17 00:00:00 2001
2 From: Peter Zijlstra <peterz@infradead.org>
3 Date: Tue, 5 Dec 2017 13:34:46 +0100
4 Subject: [PATCH 177/241] x86/mm: Remove superfluous barriers
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 CVE-2017-5754
10
11 atomic64_inc_return() already implies smp_mb() before and after.
12
13 Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
14 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
15 Cc: Andy Lutomirski <luto@kernel.org>
16 Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
17 Cc: Borislav Petkov <bp@alien8.de>
18 Cc: Brian Gerst <brgerst@gmail.com>
19 Cc: Dave Hansen <dave.hansen@linux.intel.com>
20 Cc: David Laight <David.Laight@aculab.com>
21 Cc: Denys Vlasenko <dvlasenk@redhat.com>
22 Cc: Eduardo Valentin <eduval@amazon.com>
23 Cc: Greg KH <gregkh@linuxfoundation.org>
24 Cc: H. Peter Anvin <hpa@zytor.com>
25 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
26 Cc: Juergen Gross <jgross@suse.com>
27 Cc: Linus Torvalds <torvalds@linux-foundation.org>
28 Cc: Peter Zijlstra <peterz@infradead.org>
29 Cc: Will Deacon <will.deacon@arm.com>
30 Cc: aliguori@amazon.com
31 Cc: daniel.gruss@iaik.tugraz.at
32 Cc: hughd@google.com
33 Cc: keescook@google.com
34 Cc: linux-mm@kvack.org
35 Signed-off-by: Ingo Molnar <mingo@kernel.org>
36 (cherry picked from commit b5fc6d943808b570bdfbec80f40c6b3855f1c48b)
37 Signed-off-by: Andy Whitcroft <apw@canonical.com>
38 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
39 (cherry picked from commit 31a37930df33315a7006b46706f6babdb57db1f4)
40 Signed-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
45 diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
46 index 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 --
71 2.14.2
72