]> git.proxmox.com Git - pve-kernel.git/blame - 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
CommitLineData
321d628a
FG
1From 4eeffdaf7e8e034633bab44f61c5f92002179d28 Mon Sep 17 00:00:00 2001
2From: Thomas Gleixner <tglx@linutronix.de>
3Date: Mon, 4 Dec 2017 15:07:43 +0100
e4cdf2a5 4Subject: [PATCH 197/241] x86/mm/pti: Force entry through trampoline when PTI
321d628a
FG
5 active
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10CVE-2017-5754
11
12Force the entry through the trampoline only when PTI is active. Otherwise
13go through the normal entry code.
14
15Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16Reviewed-by: Borislav Petkov <bp@suse.de>
17Cc: Andy Lutomirski <luto@kernel.org>
18Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
19Cc: Borislav Petkov <bp@alien8.de>
20Cc: Brian Gerst <brgerst@gmail.com>
21Cc: Dave Hansen <dave.hansen@linux.intel.com>
22Cc: David Laight <David.Laight@aculab.com>
23Cc: Denys Vlasenko <dvlasenk@redhat.com>
24Cc: Eduardo Valentin <eduval@amazon.com>
25Cc: Greg KH <gregkh@linuxfoundation.org>
26Cc: H. Peter Anvin <hpa@zytor.com>
27Cc: Josh Poimboeuf <jpoimboe@redhat.com>
28Cc: Juergen Gross <jgross@suse.com>
29Cc: Linus Torvalds <torvalds@linux-foundation.org>
30Cc: Peter Zijlstra <peterz@infradead.org>
31Cc: Will Deacon <will.deacon@arm.com>
32Cc: aliguori@amazon.com
33Cc: daniel.gruss@iaik.tugraz.at
34Cc: hughd@google.com
35Cc: keescook@google.com
36Signed-off-by: Ingo Molnar <mingo@kernel.org>
37(cherry picked from commit 8d4b067895791ab9fdb1aadfc505f64d71239dd2)
38Signed-off-by: Andy Whitcroft <apw@canonical.com>
39Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
40(cherry picked from commit 9ae1ea4821648be179a96fe65b3ed4bd111a5c98)
41Signed-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
46diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
47index 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--
632.14.2
64