]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0079-x86-asm-Don-t-use-the-confusing-.ifeq-directive.patch
KPTI: add follow-up fixes
[pve-kernel.git] / patches / kernel / 0079-x86-asm-Don-t-use-the-confusing-.ifeq-directive.patch
1 From 05096d194a52721b3f4add5f854fc62296b82e72 Mon Sep 17 00:00:00 2001
2 From: Josh Poimboeuf <jpoimboe@redhat.com>
3 Date: Fri, 20 Oct 2017 11:21:35 -0500
4 Subject: [PATCH 079/241] x86/asm: Don't use the confusing '.ifeq' directive
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 I find the '.ifeq <expression>' directive to be confusing. Reading it
12 quickly seems to suggest its opposite meaning, or that it's missing an
13 argument.
14
15 Improve readability by replacing all of its x86 uses with
16 '.if <expression> == 0'.
17
18 Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
19 Cc: Andrei Vagin <avagin@virtuozzo.com>
20 Cc: Andy Lutomirski <luto@kernel.org>
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/757da028e802c7e98d23fbab8d234b1063e161cf.1508516398.git.jpoimboe@redhat.com
25 Signed-off-by: Ingo Molnar <mingo@kernel.org>
26 (cherry picked from commit 82c62fa0c49aa305104013cee4468772799bb391)
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 981dedac1061fb47d0b04e07f6752be195d7e41a)
30 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
31 ---
32 arch/x86/entry/entry_64.S | 2 +-
33 arch/x86/kernel/head_32.S | 2 +-
34 arch/x86/kernel/head_64.S | 2 +-
35 3 files changed, 3 insertions(+), 3 deletions(-)
36
37 diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
38 index 2e4fc6425f47..34adfe0221d2 100644
39 --- a/arch/x86/entry/entry_64.S
40 +++ b/arch/x86/entry/entry_64.S
41 @@ -830,7 +830,7 @@ ENTRY(\sym)
42
43 ASM_CLAC
44
45 - .ifeq \has_error_code
46 + .if \has_error_code == 0
47 pushq $-1 /* ORIG_RAX: no syscall to restart */
48 .endif
49
50 diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
51 index 1f85ee8f9439..337a65377baf 100644
52 --- a/arch/x86/kernel/head_32.S
53 +++ b/arch/x86/kernel/head_32.S
54 @@ -435,7 +435,7 @@ ENTRY(early_idt_handler_array)
55 # 24(%rsp) error code
56 i = 0
57 .rept NUM_EXCEPTION_VECTORS
58 - .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
59 + .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0
60 pushl $0 # Dummy error code, to make stack frame uniform
61 .endif
62 pushl $i # 20(%esp) Vector number
63 diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
64 index 12daaa0b187f..a2d8541b1da4 100644
65 --- a/arch/x86/kernel/head_64.S
66 +++ b/arch/x86/kernel/head_64.S
67 @@ -258,7 +258,7 @@ ENDPROC(start_cpu0)
68 ENTRY(early_idt_handler_array)
69 i = 0
70 .rept NUM_EXCEPTION_VECTORS
71 - .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
72 + .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0
73 UNWIND_HINT_IRET_REGS
74 pushq $0 # Dummy error code, to make stack frame uniform
75 .else
76 --
77 2.14.2
78