x86/ibt: Add ANNOTATE_NOENDBR
[ Upstream commit c8c301abeae58ec756b8fcb2178a632bd3c9e284 ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
bbbe1b23c7
commit
20e24c8b4c
@@ -82,6 +82,12 @@ struct unwind_hint {
|
|||||||
#define STACK_FRAME_NON_STANDARD_FP(func)
|
#define STACK_FRAME_NON_STANDARD_FP(func)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ANNOTATE_NOENDBR \
|
||||||
|
"986: \n\t" \
|
||||||
|
".pushsection .discard.noendbr\n\t" \
|
||||||
|
_ASM_PTR " 986b\n\t" \
|
||||||
|
".popsection\n\t"
|
||||||
|
|
||||||
#else /* __ASSEMBLY__ */
|
#else /* __ASSEMBLY__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,6 +134,13 @@ struct unwind_hint {
|
|||||||
.popsection
|
.popsection
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro ANNOTATE_NOENDBR
|
||||||
|
.Lhere_\@:
|
||||||
|
.pushsection .discard.noendbr
|
||||||
|
.quad .Lhere_\@
|
||||||
|
.popsection
|
||||||
|
.endm
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
#else /* !CONFIG_STACK_VALIDATION */
|
#else /* !CONFIG_STACK_VALIDATION */
|
||||||
@@ -138,10 +151,13 @@ struct unwind_hint {
|
|||||||
"\n\t"
|
"\n\t"
|
||||||
#define STACK_FRAME_NON_STANDARD(func)
|
#define STACK_FRAME_NON_STANDARD(func)
|
||||||
#define STACK_FRAME_NON_STANDARD_FP(func)
|
#define STACK_FRAME_NON_STANDARD_FP(func)
|
||||||
|
#define ANNOTATE_NOENDBR
|
||||||
#else
|
#else
|
||||||
#define ANNOTATE_INTRA_FUNCTION_CALL
|
#define ANNOTATE_INTRA_FUNCTION_CALL
|
||||||
.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0
|
.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0
|
||||||
.endm
|
.endm
|
||||||
|
.macro ANNOTATE_NOENDBR
|
||||||
|
.endm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_STACK_VALIDATION */
|
#endif /* CONFIG_STACK_VALIDATION */
|
||||||
|
@@ -82,6 +82,12 @@ struct unwind_hint {
|
|||||||
#define STACK_FRAME_NON_STANDARD_FP(func)
|
#define STACK_FRAME_NON_STANDARD_FP(func)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ANNOTATE_NOENDBR \
|
||||||
|
"986: \n\t" \
|
||||||
|
".pushsection .discard.noendbr\n\t" \
|
||||||
|
_ASM_PTR " 986b\n\t" \
|
||||||
|
".popsection\n\t"
|
||||||
|
|
||||||
#else /* __ASSEMBLY__ */
|
#else /* __ASSEMBLY__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,6 +134,13 @@ struct unwind_hint {
|
|||||||
.popsection
|
.popsection
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro ANNOTATE_NOENDBR
|
||||||
|
.Lhere_\@:
|
||||||
|
.pushsection .discard.noendbr
|
||||||
|
.quad .Lhere_\@
|
||||||
|
.popsection
|
||||||
|
.endm
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
#else /* !CONFIG_STACK_VALIDATION */
|
#else /* !CONFIG_STACK_VALIDATION */
|
||||||
@@ -138,10 +151,13 @@ struct unwind_hint {
|
|||||||
"\n\t"
|
"\n\t"
|
||||||
#define STACK_FRAME_NON_STANDARD(func)
|
#define STACK_FRAME_NON_STANDARD(func)
|
||||||
#define STACK_FRAME_NON_STANDARD_FP(func)
|
#define STACK_FRAME_NON_STANDARD_FP(func)
|
||||||
|
#define ANNOTATE_NOENDBR
|
||||||
#else
|
#else
|
||||||
#define ANNOTATE_INTRA_FUNCTION_CALL
|
#define ANNOTATE_INTRA_FUNCTION_CALL
|
||||||
.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0
|
.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0
|
||||||
.endm
|
.endm
|
||||||
|
.macro ANNOTATE_NOENDBR
|
||||||
|
.endm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_STACK_VALIDATION */
|
#endif /* CONFIG_STACK_VALIDATION */
|
||||||
|
Reference in New Issue
Block a user