]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0092-x86-entry-64-Merge-the-fast-and-slow-SYSRET-paths.patch
7a080e564c97db19cadfa1802c8f5a929995e123
[pve-kernel.git] / patches / kernel / 0092-x86-entry-64-Merge-the-fast-and-slow-SYSRET-paths.patch
1 From c48697564de6da427f1e97a38192f4d456223942 Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Thu, 2 Nov 2017 00:59:04 -0700
4 Subject: [PATCH 092/233] x86/entry/64: Merge the fast and slow SYSRET paths
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 They did almost the same thing. Remove a bunch of pointless
12 instructions (mostly hidden in macros) and reduce cognitive load by
13 merging them.
14
15 Signed-off-by: Andy Lutomirski <luto@kernel.org>
16 Cc: Borislav Petkov <bpetkov@suse.de>
17 Cc: Brian Gerst <brgerst@gmail.com>
18 Cc: Dave Hansen <dave.hansen@intel.com>
19 Cc: Linus Torvalds <torvalds@linux-foundation.org>
20 Cc: Peter Zijlstra <peterz@infradead.org>
21 Cc: Thomas Gleixner <tglx@linutronix.de>
22 Link: http://lkml.kernel.org/r/1204e20233fcab9130a1ba80b3b1879b5db3fc1f.1509609304.git.luto@kernel.org
23 Signed-off-by: Ingo Molnar <mingo@kernel.org>
24 (cherry picked from commit a512210643da8082cb44181dba8b18e752bd68f0)
25 Signed-off-by: Andy Whitcroft <apw@canonical.com>
26 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
27 (cherry picked from commit 7c4575d8bb2d01960ba9b9840fa22460e0179eca)
28 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
29 ---
30 arch/x86/entry/entry_64.S | 6 +++---
31 1 file changed, 3 insertions(+), 3 deletions(-)
32
33 diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
34 index 33a416c7df2d..87be1cd1fa88 100644
35 --- a/arch/x86/entry/entry_64.S
36 +++ b/arch/x86/entry/entry_64.S
37 @@ -220,10 +220,9 @@ entry_SYSCALL_64_fastpath:
38 TRACE_IRQS_ON /* user mode is traced as IRQs on */
39 movq RIP(%rsp), %rcx
40 movq EFLAGS(%rsp), %r11
41 - RESTORE_C_REGS_EXCEPT_RCX_R11
42 - movq RSP(%rsp), %rsp
43 + addq $6*8, %rsp /* skip extra regs -- they were preserved */
44 UNWIND_HINT_EMPTY
45 - USERGS_SYSRET64
46 + jmp .Lpop_c_regs_except_rcx_r11_and_sysret
47
48 1:
49 /*
50 @@ -317,6 +316,7 @@ syscall_return_via_sysret:
51 /* rcx and r11 are already restored (see code above) */
52 UNWIND_HINT_EMPTY
53 POP_EXTRA_REGS
54 +.Lpop_c_regs_except_rcx_r11_and_sysret:
55 popq %rsi /* skip r11 */
56 popq %r10
57 popq %r9
58 --
59 2.14.2
60