2018-01-15 14:26:15 +03:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-01-06 17:13:39 +03:00
|
|
|
From: Andy Lutomirski <luto@kernel.org>
|
|
|
|
Date: Mon, 4 Dec 2017 15:07:14 +0100
|
2018-01-15 14:26:15 +03:00
|
|
|
Subject: [PATCH] x86/entry/gdt: Put per-CPU GDT remaps in ascending order
|
2018-01-06 17:13:39 +03:00
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
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>
|
|
|
|
(cherry picked from commit aaeed3aeb39c1ba69f0a49baec8cb728121d0a91)
|
|
|
|
Signed-off-by: Andy Whitcroft <apw@canonical.com>
|
|
|
|
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
|
|
|
|
(cherry picked from commit 9c37967fad2d6a525df53e0a40edcd652e5abaae)
|
|
|
|
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
|
|
|
---
|
|
|
|
arch/x86/include/asm/desc.h | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
|
|
|
|
index f995e5a09136..22ee0a93b4f7 100644
|
|
|
|
--- a/arch/x86/include/asm/desc.h
|
|
|
|
+++ b/arch/x86/include/asm/desc.h
|
|
|
|
@@ -61,7 +61,7 @@ static inline struct desc_struct *get_current_gdt_rw(void)
|
|
|
|
/* 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 */
|
|
|
|
--
|
|
|
|
2.14.2
|
|
|
|
|