]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0088-x86-entry-64-Remove-the-restore_c_regs_and_iret-labe.patch
436f7daa5199e9b65743b91401de256029b05520
[pve-kernel.git] / patches / kernel / 0088-x86-entry-64-Remove-the-restore_c_regs_and_iret-labe.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Thu, 2 Nov 2017 00:58:58 -0700
4 Subject: [PATCH] x86/entry/64: Remove the restore_c_regs_and_iret label
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 The only user was the 64-bit opportunistic SYSRET failure path, and
12 that path didn't really need it. This change makes the
13 opportunistic SYSRET code a bit more straightforward and gets rid of
14 the label.
15
16 Signed-off-by: Andy Lutomirski <luto@kernel.org>
17 Reviewed-by: Borislav Petkov <bp@suse.de>
18 Cc: Borislav Petkov <bpetkov@suse.de>
19 Cc: Brian Gerst <brgerst@gmail.com>
20 Cc: Dave Hansen <dave.hansen@intel.com>
21 Cc: Linus Torvalds <torvalds@linux-foundation.org>
22 Cc: Peter Zijlstra <peterz@infradead.org>
23 Cc: Thomas Gleixner <tglx@linutronix.de>
24 Link: http://lkml.kernel.org/r/be3006a7ad3326e3458cf1cc55d416252cbe1986.1509609304.git.luto@kernel.org
25 Signed-off-by: Ingo Molnar <mingo@kernel.org>
26 (cherry picked from commit 9da78ba6b47b46428cfdfc0851511ab29c869798)
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 629c8b858cbe72e88e7f44a8f10e1b434ab80721)
30 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
31 ---
32 arch/x86/entry/entry_64.S | 5 ++---
33 1 file changed, 2 insertions(+), 3 deletions(-)
34
35 diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
36 index 34adfe0221d2..fac354ddf056 100644
37 --- a/arch/x86/entry/entry_64.S
38 +++ b/arch/x86/entry/entry_64.S
39 @@ -245,7 +245,6 @@ entry_SYSCALL64_slow_path:
40 call do_syscall_64 /* returns with IRQs disabled */
41
42 return_from_SYSCALL_64:
43 - RESTORE_EXTRA_REGS
44 TRACE_IRQS_IRETQ /* we're about to change IF */
45
46 /*
47 @@ -314,6 +313,7 @@ return_from_SYSCALL_64:
48 */
49 syscall_return_via_sysret:
50 /* rcx and r11 are already restored (see code above) */
51 + RESTORE_EXTRA_REGS
52 RESTORE_C_REGS_EXCEPT_RCX_R11
53 movq RSP(%rsp), %rsp
54 UNWIND_HINT_EMPTY
55 @@ -321,7 +321,7 @@ syscall_return_via_sysret:
56
57 opportunistic_sysret_failed:
58 SWAPGS
59 - jmp restore_c_regs_and_iret
60 + jmp restore_regs_and_iret
61 END(entry_SYSCALL_64)
62
63 ENTRY(stub_ptregs_64)
64 @@ -638,7 +638,6 @@ retint_kernel:
65 */
66 GLOBAL(restore_regs_and_iret)
67 RESTORE_EXTRA_REGS
68 -restore_c_regs_and_iret:
69 RESTORE_C_REGS
70 REMOVE_PT_GPREGS_FROM_STACK 8
71 INTERRUPT_RETURN
72 --
73 2.14.2
74