]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0201-x86-mm-pti-Map-ESPFIX-into-user-space.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0201-x86-mm-pti-Map-ESPFIX-into-user-space.patch
CommitLineData
321d628a
FG
1From 9378cf5830b41fc4659335da883d2a1d52fe0661 Mon Sep 17 00:00:00 2001
2From: Andy Lutomirski <luto@kernel.org>
3Date: Fri, 15 Dec 2017 22:08:18 +0100
e4cdf2a5 4Subject: [PATCH 201/241] x86/mm/pti: Map ESPFIX into user space
321d628a
FG
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9CVE-2017-5754
10
11Map the ESPFIX pages into user space when PTI is enabled.
12
13Signed-off-by: Andy Lutomirski <luto@kernel.org>
14Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
15Cc: Borislav Petkov <bp@alien8.de>
16Cc: Brian Gerst <brgerst@gmail.com>
17Cc: Dave Hansen <dave.hansen@linux.intel.com>
18Cc: David Laight <David.Laight@aculab.com>
19Cc: H. Peter Anvin <hpa@zytor.com>
20Cc: Josh Poimboeuf <jpoimboe@redhat.com>
21Cc: Juergen Gross <jgross@suse.com>
22Cc: Kees Cook <keescook@chromium.org>
23Cc: Linus Torvalds <torvalds@linux-foundation.org>
24Cc: Peter Zijlstra <peterz@infradead.org>
25Signed-off-by: Ingo Molnar <mingo@kernel.org>
26(cherry picked from commit 4b6bbe95b87966ba08999574db65c93c5e925a36)
27Signed-off-by: Andy Whitcroft <apw@canonical.com>
28Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
29(cherry picked from commit f5103cc3035ae6d1816404696ee2eb06d53b6709)
30Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
31---
32 arch/x86/mm/pti.c | 11 +++++++++++
33 1 file changed, 11 insertions(+)
34
35diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
36index 0e78797650a7..b1c38ef9fbbb 100644
37--- a/arch/x86/mm/pti.c
38+++ b/arch/x86/mm/pti.c
39@@ -287,6 +287,16 @@ static void __init pti_clone_user_shared(void)
40 pti_clone_p4d(CPU_ENTRY_AREA_BASE);
41 }
42
43+/*
44+ * Clone the ESPFIX P4D into the user space visinble page table
45+ */
46+static void __init pti_setup_espfix64(void)
47+{
48+#ifdef CONFIG_X86_ESPFIX64
49+ pti_clone_p4d(ESPFIX_BASE_ADDR);
50+#endif
51+}
52+
53 /*
54 * Clone the populated PMDs of the entry and irqentry text and force it RO.
55 */
56@@ -308,4 +318,5 @@ void __init pti_init(void)
57
58 pti_clone_user_shared();
59 pti_clone_entry_text();
60+ pti_setup_espfix64();
61 }
62--
632.14.2
64