Commit 82de9301 authored by David Woodhouse's avatar David Woodhouse Committed by Greg Kroah-Hartman

x86/retpoline/ftrace: Convert ftrace assembler indirect jumps

commit 9351803b upstream.

Convert all indirect jumps in ftrace assembler code to use non-speculative
sequences when CONFIG_RETPOLINE is enabled.
Signed-off-by: default avatarDavid Woodhouse <>
Signed-off-by: default avatarThomas Gleixner <>
Acked-by: default avatarArjan van de Ven <>
Acked-by: default avatarIngo Molnar <>
Cc: Rik van Riel <>
Cc: Andi Kleen <>
Cc: Josh Poimboeuf <>
Cc: Peter Zijlstra <>
Cc: Linus Torvalds <>
Cc: Jiri Kosina <>
Cc: Andy Lutomirski <>
Cc: Dave Hansen <>
Cc: Kees Cook <>
Cc: Tim Chen <>
Cc: Greg Kroah-Hartman <>
Cc: Paul Turner <>
Link: default avatarGreg Kroah-Hartman <>
parent d4edaa98
......@@ -8,6 +8,7 @@
#include <asm/segment.h>
#include <asm/export.h>
#include <asm/ftrace.h>
#include <asm/nospec-branch.h>
# define function_hook __fentry__
......@@ -197,7 +198,8 @@ ftrace_stub:
movl 0x4(%ebp), %edx
subl $MCOUNT_INSN_SIZE, %eax
call *ftrace_trace_function
movl ftrace_trace_function, %ecx
popl %edx
popl %ecx
......@@ -241,5 +243,5 @@ return_to_handler:
movl %eax, %ecx
popl %edx
popl %eax
jmp *%ecx
......@@ -7,7 +7,7 @@
#include <asm/ptrace.h>
#include <asm/ftrace.h>
#include <asm/export.h>
#include <asm/nospec-branch.h>
.section .entry.text, "ax"
......@@ -286,8 +286,8 @@ trace:
* ip and parent ip are used and the list function is called when
* function tracing is enabled.
call *ftrace_trace_function
movq ftrace_trace_function, %r8
jmp fgraph_trace
......@@ -329,5 +329,5 @@ GLOBAL(return_to_handler)
movq 8(%rsp), %rdx
movq (%rsp), %rax
addq $24, %rsp
jmp *%rdi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment