1 From 9378cf5830b41fc4659335da883d2a1d52fe0661 Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Fri, 15 Dec 2017 22:08:18 +0100
4 Subject: [PATCH 201/233] x86/mm/pti: Map ESPFIX into user space
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Map the ESPFIX pages into user space when PTI is enabled.
13 Signed-off-by: Andy Lutomirski <luto@kernel.org>
14 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
15 Cc: Borislav Petkov <bp@alien8.de>
16 Cc: Brian Gerst <brgerst@gmail.com>
17 Cc: Dave Hansen <dave.hansen@linux.intel.com>
18 Cc: David Laight <David.Laight@aculab.com>
19 Cc: H. Peter Anvin <hpa@zytor.com>
20 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
21 Cc: Juergen Gross <jgross@suse.com>
22 Cc: Kees Cook <keescook@chromium.org>
23 Cc: Linus Torvalds <torvalds@linux-foundation.org>
24 Cc: Peter Zijlstra <peterz@infradead.org>
25 Signed-off-by: Ingo Molnar <mingo@kernel.org>
26 (cherry picked from commit 4b6bbe95b87966ba08999574db65c93c5e925a36)
27 Signed-off-by: Andy Whitcroft <apw@canonical.com>
28 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
29 (cherry picked from commit f5103cc3035ae6d1816404696ee2eb06d53b6709)
30 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
32 arch/x86/mm/pti.c | 11 +++++++++++
33 1 file changed, 11 insertions(+)
35 diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
36 index 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);
44 + * Clone the ESPFIX P4D into the user space visinble page table
46 +static void __init pti_setup_espfix64(void)
48 +#ifdef CONFIG_X86_ESPFIX64
49 + pti_clone_p4d(ESPFIX_BASE_ADDR);
54 * Clone the populated PMDs of the entry and irqentry text and force it RO.
56 @@ -308,4 +318,5 @@ void __init pti_init(void)
58 pti_clone_user_shared();
59 pti_clone_entry_text();
60 + pti_setup_espfix64();