summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/unwind_hints.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-04-01 17:38:19 +0300
committerIngo Molnar <mingo@kernel.org>2020-04-22 11:53:50 +0300
commite25eea89bb8853763a22fa2547199cf96b571ba1 (patch)
treef766e439a5bb171c5c71a56943a684f0e6716723 /arch/x86/include/asm/unwind_hints.h
parentb746046238bb99b8f703c79f6d95357428fb6476 (diff)
downloadlinux-e25eea89bb8853763a22fa2547199cf96b571ba1.tar.xz
objtool: Introduce HINT_RET_OFFSET
Normally objtool ensures a function keeps the stack layout invariant. But there is a useful exception, it is possible to stuff the return stack in order to 'inject' a 'call': push $fun ret In this case the invariant mentioned above is violated. Add an objtool HINT to annotate this and allow a function exit with a modified stack frame. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20200416115118.690601403@infradead.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/unwind_hints.h')
-rw-r--r--arch/x86/include/asm/unwind_hints.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/include/asm/unwind_hints.h b/arch/x86/include/asm/unwind_hints.h
index f5e2eb12cb71..aabf7ace0476 100644
--- a/arch/x86/include/asm/unwind_hints.h
+++ b/arch/x86/include/asm/unwind_hints.h
@@ -94,6 +94,16 @@
UNWIND_HINT type=UNWIND_HINT_TYPE_RESTORE
.endm
+
+/*
+ * RET_OFFSET: Used on instructions that terminate a function; mostly RETURN
+ * and sibling calls. On these, sp_offset denotes the expected offset from
+ * initial_func_cfi.
+ */
+.macro UNWIND_HINT_RET_OFFSET sp_offset=8
+ UNWIND_HINT type=UNWIND_HINT_TYPE_RET_OFFSET sp_offset=\sp_offset
+.endm
+
#else /* !__ASSEMBLY__ */
#define UNWIND_HINT(sp_reg, sp_offset, type, end) \