Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2018-01-12 21:55:29 +0100
committerBorislav Petkov <bp@suse.de>2018-01-12 21:55:34 +0100
commit0fe479c0dd3dc50e9e0b866babd710bbd78e929a (patch)
tree11ea0f73827430ec79f63cd7fe193315bda32ae3
parent062ff712bfb7630d215f369df69d0a38ea12b6a6 (diff)
x86/entry/gdt: Put per-CPU GDT remaps in ascending order
(bsc#1068032 CVE-2017-5754).
-rw-r--r--patches.arch/07-x86-entry-gdt-put-per-cpu-gdt-remaps-in-ascending-order.patch58
-rw-r--r--series.conf1
2 files changed, 59 insertions, 0 deletions
diff --git a/patches.arch/07-x86-entry-gdt-put-per-cpu-gdt-remaps-in-ascending-order.patch b/patches.arch/07-x86-entry-gdt-put-per-cpu-gdt-remaps-in-ascending-order.patch
new file mode 100644
index 0000000000..efe8873217
--- /dev/null
+++ b/patches.arch/07-x86-entry-gdt-put-per-cpu-gdt-remaps-in-ascending-order.patch
@@ -0,0 +1,58 @@
+From: Andy Lutomirski <luto@kernel.org>
+Date: Mon, 4 Dec 2017 15:07:14 +0100
+Subject: x86/entry/gdt: Put per-CPU GDT remaps in ascending order
+Git-commit: aaeed3aeb39c1ba69f0a49baec8cb728121d0a91
+Patch-mainline: v4.15-rc5
+References: bsc#1068032 CVE-2017-5754
+
+We currently have CPU 0's GDT at the top of the GDT range and
+higher-numbered CPUs at lower addresses. This happens because the
+fixmap is upside down (index 0 is the top of the fixmap).
+
+Flip it so that GDTs are in ascending order by virtual address.
+This will simplify a future patch that will generalize the GDT
+remap to contain multiple pages.
+
+Signed-off-by: Andy Lutomirski <luto@kernel.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Borislav Petkov <bpetkov@suse.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: David Laight <David.Laight@aculab.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: Eduardo Valentin <eduval@amazon.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Cc: aliguori@amazon.com
+Cc: daniel.gruss@iaik.tugraz.at
+Cc: hughd@google.com
+Cc: keescook@google.com
+Link: https://lkml.kernel.org/r/20171204150605.471561421@linutronix.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Acked-by: Borislav Petkov <bp@suse.de>
+---
+ arch/x86/include/asm/desc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/include/asm/desc.h
++++ b/arch/x86/include/asm/desc.h
+@@ -61,7 +61,7 @@ static inline struct desc_struct *get_cu
+ /* Get the fixmap index for a specific processor */
+ static inline unsigned int get_cpu_gdt_ro_index(int cpu)
+ {
+- return FIX_GDT_REMAP_BEGIN + cpu;
++ return FIX_GDT_REMAP_END - cpu;
+ }
+
+ /* Provide the fixmap address of the remapped GDT */
diff --git a/series.conf b/series.conf
index 7107b8b6cc..77c1844d4e 100644
--- a/series.conf
+++ b/series.conf
@@ -7378,6 +7378,7 @@
patches.arch/04-x86-irq-64-print-the-offending-ip-in-the-stack-overflow-warning.patch
patches.arch/05-x86-entry-64-allocate-and-enable-the-sysenter-stack.patch
patches.arch/06-x86-dumpstack-add-get_stack_info-support-for-the-sysenter-stack.patch
+ patches.arch/07-x86-entry-gdt-put-per-cpu-gdt-remaps-in-ascending-order.patch
########################################################
# Staging tree patches