-From pasha.tatashin@oracle.com Sat Jan 13 14:14:57 2018
+From pasha.tatashin@oracle.com Sat Jan 13 14:51:06 2018
From: Pavel Tatashin <pasha.tatashin@oracle.com>
-Date: Thu, 11 Jan 2018 14:07:46 -0500
+Date: Fri, 12 Jan 2018 15:00:02 -0500
Subject: x86/pti/efi: broken conversion from efi to kernel page table
To: steven.sistare@oracle.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, gregkh@linuxfoundation.org, jkosina@suse.cz, hughd@google.com, dave.hansen@linux.intel.com, luto@kernel.org, torvalds@linux-foundation.org
-Message-ID: <20180111190746.15426-2-pasha.tatashin@oracle.com>
+Message-ID: <20180112200002.25907-1-pasha.tatashin@oracle.com>
From: Pavel Tatashin <pasha.tatashin@oracle.com>
Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- arch/x86/include/asm/kaiser.h | 8 ++++++++
+ arch/x86/include/asm/kaiser.h | 10 ++++++++++
arch/x86/realmode/init.c | 4 +++-
arch/x86/realmode/rm/trampoline_64.S | 3 ++-
- 3 files changed, 13 insertions(+), 2 deletions(-)
+ 3 files changed, 15 insertions(+), 2 deletions(-)
--- a/arch/x86/include/asm/kaiser.h
+++ b/arch/x86/include/asm/kaiser.h
-@@ -19,6 +19,12 @@
+@@ -19,6 +19,16 @@
#define KAISER_SHADOW_PGD_OFFSET 0x1000
++#ifdef CONFIG_PAGE_TABLE_ISOLATION
+/*
+ * A page table address must have this alignment to stay the same when
+ * KAISER_SHADOW_PGD_OFFSET mask is applied
+ */
+#define KAISER_KERNEL_PGD_ALIGNMENT (KAISER_SHADOW_PGD_OFFSET << 1)
++#else
++#define KAISER_KERNEL_PGD_ALIGNMENT PAGE_SIZE
++#endif
+
#ifdef __ASSEMBLY__
#ifdef CONFIG_PAGE_TABLE_ISOLATION
-@@ -71,6 +77,8 @@ movq PER_CPU_VAR(unsafe_stack_register_b
-
- #else /* CONFIG_PAGE_TABLE_ISOLATION */
-
-+#define KAISER_KERNEL_PGD_ALIGNMENT PAGE_SIZE
-+
- .macro SWITCH_KERNEL_CR3
- .endm
- .macro SWITCH_USER_CR3
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
-@@ -1,5 +1,6 @@
- #include <linux/io.h>
- #include <linux/memblock.h>
-+#include <linux/kaiser.h>
-
+@@ -4,6 +4,7 @@
#include <asm/cacheflush.h>
#include <asm/pgtable.h>
+ #include <asm/realmode.h>
++#include <asm/kaiser.h>
+
+ struct real_mode_header *real_mode_header;
+ u32 *trampoline_cr4_features;
@@ -15,7 +16,8 @@ void __init reserve_real_mode(void)
size_t size = PAGE_ALIGN(real_mode_blob_end - real_mode_blob);