[PATCH V2 8/9] x86/speculation: Add unwind hint to trampoline return
From: Alexandre Chartre
Date: Tue Apr 07 2020 - 03:28:22 EST
With retpoline, the address to branch to is pushed on the stack and
the return instruction (ret) is used to jump to that address. Use the
UNWIND_HINT_RET_OFFSET directive to inform objtool that the stack
should be adjusted.
Signed-off-by: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
replace RETPOLINE_RET with UNWIND_HINT_RET_OFFSET
---
arch/x86/include/asm/nospec-branch.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index a345c6fa0541..5ce2a40a26da 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -10,6 +10,7 @@
#include <asm/alternative-asm.h>
#include <asm/cpufeatures.h>
#include <asm/msr-index.h>
+#include <asm/unwind_hints.h>
/*
* This should be used immediately before a retpoline alternative. It tells
@@ -100,6 +101,7 @@
jmp .Lspec_trap_\@
.Ldo_rop_\@:
mov \reg, (%_ASM_SP)
+ UNWIND_HINT_RET_OFFSET
ret
.endm
--
2.18.2