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