]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0197-x86-mm-pti-Force-entry-through-trampoline-when-PTI-a.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0197-x86-mm-pti-Force-entry-through-trampoline-when-PTI-a.patch
1 From 4eeffdaf7e8e034633bab44f61c5f92002179d28 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Mon, 4 Dec 2017 15:07:43 +0100
4 Subject: [PATCH 197/241] x86/mm/pti: Force entry through trampoline when PTI
5 active
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 CVE-2017-5754
11
12 Force the entry through the trampoline only when PTI is active. Otherwise
13 go through the normal entry code.
14
15 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 Reviewed-by: Borislav Petkov <bp@suse.de>
17 Cc: Andy Lutomirski <luto@kernel.org>
18 Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
19 Cc: Borislav Petkov <bp@alien8.de>
20 Cc: Brian Gerst <brgerst@gmail.com>
21 Cc: Dave Hansen <dave.hansen@linux.intel.com>
22 Cc: David Laight <David.Laight@aculab.com>
23 Cc: Denys Vlasenko <dvlasenk@redhat.com>
24 Cc: Eduardo Valentin <eduval@amazon.com>
25 Cc: Greg KH <gregkh@linuxfoundation.org>
26 Cc: H. Peter Anvin <hpa@zytor.com>
27 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
28 Cc: Juergen Gross <jgross@suse.com>
29 Cc: Linus Torvalds <torvalds@linux-foundation.org>
30 Cc: Peter Zijlstra <peterz@infradead.org>
31 Cc: Will Deacon <will.deacon@arm.com>
32 Cc: aliguori@amazon.com
33 Cc: daniel.gruss@iaik.tugraz.at
34 Cc: hughd@google.com
35 Cc: keescook@google.com
36 Signed-off-by: Ingo Molnar <mingo@kernel.org>
37 (cherry picked from commit 8d4b067895791ab9fdb1aadfc505f64d71239dd2)
38 Signed-off-by: Andy Whitcroft <apw@canonical.com>
39 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
40 (cherry picked from commit 9ae1ea4821648be179a96fe65b3ed4bd111a5c98)
41 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
42 ---
43 arch/x86/kernel/cpu/common.c | 5 ++++-
44 1 file changed, 4 insertions(+), 1 deletion(-)
45
46 diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
47 index 623ba3635793..99f37d1636ff 100644
48 --- a/arch/x86/kernel/cpu/common.c
49 +++ b/arch/x86/kernel/cpu/common.c
50 @@ -1340,7 +1340,10 @@ void syscall_init(void)
51 (entry_SYSCALL_64_trampoline - _entry_trampoline);
52
53 wrmsr(MSR_STAR, 0, (__USER32_CS << 16) | __KERNEL_CS);
54 - wrmsrl(MSR_LSTAR, SYSCALL64_entry_trampoline);
55 + if (static_cpu_has(X86_FEATURE_PTI))
56 + wrmsrl(MSR_LSTAR, SYSCALL64_entry_trampoline);
57 + else
58 + wrmsrl(MSR_LSTAR, (unsigned long)entry_SYSCALL_64);
59
60 #ifdef CONFIG_IA32_EMULATION
61 wrmsrl(MSR_CSTAR, (unsigned long)entry_SYSCALL_compat);
62 --
63 2.14.2
64