Messages in this thread Patch in this message | | | From | Andi Kleen <> | Subject | [PATCH 04/11] x86/retpoline/ftrace: Convert ftrace assembler indirect jumps | Date | Wed, 3 Jan 2018 15:09:27 -0800 |
| |
From: Andi Kleen <ak@linux.intel.com>
Convert all indirect jumps in ftrace assembler code to use non speculative sequences.
Based on code from David Woodhouse and Tim Chen
Signed-off-by: Andi Kleen <ak@linux.intel.com> --- arch/x86/kernel/ftrace_32.S | 3 ++- arch/x86/kernel/ftrace_64.S | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/ftrace_32.S b/arch/x86/kernel/ftrace_32.S index b6c6468e10bc..c0c10ba53375 100644 --- a/arch/x86/kernel/ftrace_32.S +++ b/arch/x86/kernel/ftrace_32.S @@ -8,6 +8,7 @@ #include <asm/segment.h> #include <asm/export.h> #include <asm/ftrace.h> +#include <asm/jump-asm.h> #ifdef CC_USING_FENTRY # define function_hook __fentry__ @@ -241,5 +242,5 @@ return_to_handler: movl %eax, %ecx popl %edx popl %eax - jmp *%ecx + NOSPEC_JMP %ecx #endif diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index c832291d948a..4814c4b30b8d 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -7,7 +7,7 @@ #include <asm/ptrace.h> #include <asm/ftrace.h> #include <asm/export.h> - +#include <asm/jump-asm.h> .code64 .section .entry.text, "ax" @@ -286,7 +286,7 @@ trace: * ip and parent ip are used and the list function is called when * function tracing is enabled. */ - call *ftrace_trace_function + NOSPEC_CALL ftrace_trace_function restore_mcount_regs @@ -329,5 +329,5 @@ GLOBAL(return_to_handler) movq 8(%rsp), %rdx movq (%rsp), %rax addq $24, %rsp - jmp *%rdi + NOSPEC_JMP %rdi #endif -- 2.14.3
| |