summaryrefslogtreecommitdiff
path: root/include/linux/objtool.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2022-03-08 18:30:18 +0300
committerPeter Zijlstra <peterz@infradead.org>2022-03-15 12:32:33 +0300
commitc8c301abeae58ec756b8fcb2178a632bd3c9e284 (patch)
tree161ef8d2c0cc432927046dbe9aa867c608747a9d /include/linux/objtool.h
parent156ff4a544ae13c5fd6759a09ecb069f7059c1a1 (diff)
downloadlinux-c8c301abeae58ec756b8fcb2178a632bd3c9e284.tar.xz
x86/ibt: Add ANNOTATE_NOENDBR
In order to have objtool warn about code references to !ENDBR instruction, we need an annotation to allow this for non-control-flow instances -- consider text range checks, text patching, or return trampolines etc. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20220308154317.578968224@infradead.org
Diffstat (limited to 'include/linux/objtool.h')
-rw-r--r--include/linux/objtool.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/objtool.h b/include/linux/objtool.h
index aca52db2f3f3..f797368820c8 100644
--- a/include/linux/objtool.h
+++ b/include/linux/objtool.h
@@ -77,6 +77,12 @@ struct unwind_hint {
#define STACK_FRAME_NON_STANDARD_FP(func)
#endif
+#define ANNOTATE_NOENDBR \
+ "986: \n\t" \
+ ".pushsection .discard.noendbr\n\t" \
+ _ASM_PTR " 986b\n\t" \
+ ".popsection\n\t"
+
#else /* __ASSEMBLY__ */
/*
@@ -129,6 +135,13 @@ struct unwind_hint {
.popsection
.endm
+.macro ANNOTATE_NOENDBR
+.Lhere_\@:
+ .pushsection .discard.noendbr
+ .quad .Lhere_\@
+ .popsection
+.endm
+
#endif /* __ASSEMBLY__ */
#else /* !CONFIG_STACK_VALIDATION */
@@ -139,12 +152,15 @@ struct unwind_hint {
"\n\t"
#define STACK_FRAME_NON_STANDARD(func)
#define STACK_FRAME_NON_STANDARD_FP(func)
+#define ANNOTATE_NOENDBR
#else
#define ANNOTATE_INTRA_FUNCTION_CALL
.macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0
.endm
.macro STACK_FRAME_NON_STANDARD func:req
.endm
+.macro ANNOTATE_NOENDBR
+.endm
#endif
#endif /* CONFIG_STACK_VALIDATION */