]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0144-x86-entry-gdt-Put-per-CPU-GDT-remaps-in-ascending-or.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0144-x86-entry-gdt-Put-per-CPU-GDT-remaps-in-ascending-or.patch
CommitLineData
321d628a
FG
1From 337719d1c25c12c21a989f26ece1859c8007642f Mon Sep 17 00:00:00 2001
2From: Andy Lutomirski <luto@kernel.org>
3Date: Mon, 4 Dec 2017 15:07:14 +0100
e4cdf2a5 4Subject: [PATCH 144/241] x86/entry/gdt: Put per-CPU GDT remaps in ascending
321d628a
FG
5 order
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12We currently have CPU 0's GDT at the top of the GDT range and
13higher-numbered CPUs at lower addresses. This happens because the
14fixmap is upside down (index 0 is the top of the fixmap).
15
16Flip it so that GDTs are in ascending order by virtual address.
17This will simplify a future patch that will generalize the GDT
18remap to contain multiple pages.
19
20Signed-off-by: Andy Lutomirski <luto@kernel.org>
21Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
22Reviewed-by: Borislav Petkov <bp@suse.de>
23Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
24Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
25Cc: Borislav Petkov <bp@alien8.de>
26Cc: Borislav Petkov <bpetkov@suse.de>
27Cc: Brian Gerst <brgerst@gmail.com>
28Cc: Dave Hansen <dave.hansen@intel.com>
29Cc: Dave Hansen <dave.hansen@linux.intel.com>
30Cc: David Laight <David.Laight@aculab.com>
31Cc: Denys Vlasenko <dvlasenk@redhat.com>
32Cc: Eduardo Valentin <eduval@amazon.com>
33Cc: Greg KH <gregkh@linuxfoundation.org>
34Cc: H. Peter Anvin <hpa@zytor.com>
35Cc: Josh Poimboeuf <jpoimboe@redhat.com>
36Cc: Juergen Gross <jgross@suse.com>
37Cc: Linus Torvalds <torvalds@linux-foundation.org>
38Cc: Peter Zijlstra <peterz@infradead.org>
39Cc: Rik van Riel <riel@redhat.com>
40Cc: Will Deacon <will.deacon@arm.com>
41Cc: aliguori@amazon.com
42Cc: daniel.gruss@iaik.tugraz.at
43Cc: hughd@google.com
44Cc: keescook@google.com
45Link: https://lkml.kernel.org/r/20171204150605.471561421@linutronix.de
46Signed-off-by: Ingo Molnar <mingo@kernel.org>
47(cherry picked from commit aaeed3aeb39c1ba69f0a49baec8cb728121d0a91)
48Signed-off-by: Andy Whitcroft <apw@canonical.com>
49Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
50(cherry picked from commit 9c37967fad2d6a525df53e0a40edcd652e5abaae)
51Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
52---
53 arch/x86/include/asm/desc.h | 2 +-
54 1 file changed, 1 insertion(+), 1 deletion(-)
55
56diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
57index f995e5a09136..22ee0a93b4f7 100644
58--- a/arch/x86/include/asm/desc.h
59+++ b/arch/x86/include/asm/desc.h
60@@ -61,7 +61,7 @@ static inline struct desc_struct *get_current_gdt_rw(void)
61 /* Get the fixmap index for a specific processor */
62 static inline unsigned int get_cpu_gdt_ro_index(int cpu)
63 {
64- return FIX_GDT_REMAP_BEGIN + cpu;
65+ return FIX_GDT_REMAP_END - cpu;
66 }
67
68 /* Provide the fixmap address of the remapped GDT */
69--
702.14.2
71