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