Skip to content

Commit 7614e91

Browse files
Andi KleenKAGA-KOKO
authored andcommitted
x86/retpoline/irq32: Convert assembler indirect jumps
Convert all indirect jumps in 32bit irq inline asm code to use non speculative sequences. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: gnomes@lxorguk.ukuu.org.uk Cc: Rik van Riel <riel@redhat.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: thomas.lendacky@amd.com Cc: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Jiri Kosina <jikos@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Kees Cook <keescook@google.com> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org> Cc: Paul Turner <pjt@google.com> Link: https://lkml.kernel.org/r/1515707194-20531-12-git-send-email-dwmw@amazon.co.uk
1 parent 5096732 commit 7614e91

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

arch/x86/kernel/irq_32.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/mm.h>
2121

2222
#include <asm/apic.h>
23+
#include <asm/nospec-branch.h>
2324

2425
#ifdef CONFIG_DEBUG_STACKOVERFLOW
2526

@@ -55,11 +56,11 @@ DEFINE_PER_CPU(struct irq_stack *, softirq_stack);
5556
static void call_on_stack(void *func, void *stack)
5657
{
5758
asm volatile("xchgl %%ebx,%%esp \n"
58-
"call *%%edi \n"
59+
CALL_NOSPEC
5960
"movl %%ebx,%%esp \n"
6061
: "=b" (stack)
6162
: "0" (stack),
62-
"D"(func)
63+
[thunk_target] "D"(func)
6364
: "memory", "cc", "edx", "ecx", "eax");
6465
}
6566

@@ -95,11 +96,11 @@ static inline int execute_on_irq_stack(int overflow, struct irq_desc *desc)
9596
call_on_stack(print_stack_overflow, isp);
9697

9798
asm volatile("xchgl %%ebx,%%esp \n"
98-
"call *%%edi \n"
99+
CALL_NOSPEC
99100
"movl %%ebx,%%esp \n"
100101
: "=a" (arg1), "=b" (isp)
101102
: "0" (desc), "1" (isp),
102-
"D" (desc->handle_irq)
103+
[thunk_target] "D" (desc->handle_irq)
103104
: "memory", "cc", "ecx");
104105
return 1;
105106
}

0 commit comments

Comments
 (0)