From: Sasha Levin Date: Tue, 22 Aug 2023 03:04:25 +0000 (-0400) Subject: Fix up build errors on 5.15 X-Git-Tag: v6.4.12~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f063066fa9615649104b9a44c881f6fb76886917;p=thirdparty%2Fkernel%2Fstable-queue.git Fix up build errors on 5.15 --- diff --git a/queue-5.15/objtool-add-frame-pointer-specific-function-ignore.patch b/queue-5.15/objtool-add-frame-pointer-specific-function-ignore.patch new file mode 100644 index 00000000000..c6495d4f047 --- /dev/null +++ b/queue-5.15/objtool-add-frame-pointer-specific-function-ignore.patch @@ -0,0 +1,91 @@ +From 88b19a0e5cbc59720e4c808689ea87c3fa140acf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Sep 2021 23:41:13 +0900 +Subject: objtool: Add frame-pointer-specific function ignore + +From: Josh Poimboeuf + +[ Upstream commit e028c4f7ac7ca8c96126fe46c54ab3d56ffe6a66 ] + +Add a CONFIG_FRAME_POINTER-specific version of +STACK_FRAME_NON_STANDARD() for the case where a function is +intentionally missing frame pointer setup, but otherwise needs +objtool/ORC coverage when frame pointers are disabled. + +Link: https://lkml.kernel.org/r/163163047364.489837.17377799909553689661.stgit@devnote2 + +Signed-off-by: Josh Poimboeuf +Reviewed-by: Masami Hiramatsu +Tested-by: Masami Hiramatsu +Signed-off-by: Masami Hiramatsu +Signed-off-by: Steven Rostedt (VMware) +Stable-dep-of: c8c301abeae5 ("x86/ibt: Add ANNOTATE_NOENDBR") +Signed-off-by: Sasha Levin +--- + include/linux/objtool.h | 12 ++++++++++++ + tools/include/linux/objtool.h | 12 ++++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/include/linux/objtool.h b/include/linux/objtool.h +index a2042c4186864..d59e69df821eb 100644 +--- a/include/linux/objtool.h ++++ b/include/linux/objtool.h +@@ -71,6 +71,17 @@ struct unwind_hint { + static void __used __section(".discard.func_stack_frame_non_standard") \ + *__func_stack_frame_non_standard_##func = func + ++/* ++ * STACK_FRAME_NON_STANDARD_FP() is a frame-pointer-specific function ignore ++ * for the case where a function is intentionally missing frame pointer setup, ++ * but otherwise needs objtool/ORC coverage when frame pointers are disabled. ++ */ ++#ifdef CONFIG_FRAME_POINTER ++#define STACK_FRAME_NON_STANDARD_FP(func) STACK_FRAME_NON_STANDARD(func) ++#else ++#define STACK_FRAME_NON_STANDARD_FP(func) ++#endif ++ + #else /* __ASSEMBLY__ */ + + /* +@@ -132,6 +143,7 @@ struct unwind_hint { + #define UNWIND_HINT(sp_reg, sp_offset, type, end) \ + "\n\t" + #define STACK_FRAME_NON_STANDARD(func) ++#define STACK_FRAME_NON_STANDARD_FP(func) + #else + #define ANNOTATE_INTRA_FUNCTION_CALL + .macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0 +diff --git a/tools/include/linux/objtool.h b/tools/include/linux/objtool.h +index a2042c4186864..d59e69df821eb 100644 +--- a/tools/include/linux/objtool.h ++++ b/tools/include/linux/objtool.h +@@ -71,6 +71,17 @@ struct unwind_hint { + static void __used __section(".discard.func_stack_frame_non_standard") \ + *__func_stack_frame_non_standard_##func = func + ++/* ++ * STACK_FRAME_NON_STANDARD_FP() is a frame-pointer-specific function ignore ++ * for the case where a function is intentionally missing frame pointer setup, ++ * but otherwise needs objtool/ORC coverage when frame pointers are disabled. ++ */ ++#ifdef CONFIG_FRAME_POINTER ++#define STACK_FRAME_NON_STANDARD_FP(func) STACK_FRAME_NON_STANDARD(func) ++#else ++#define STACK_FRAME_NON_STANDARD_FP(func) ++#endif ++ + #else /* __ASSEMBLY__ */ + + /* +@@ -132,6 +143,7 @@ struct unwind_hint { + #define UNWIND_HINT(sp_reg, sp_offset, type, end) \ + "\n\t" + #define STACK_FRAME_NON_STANDARD(func) ++#define STACK_FRAME_NON_STANDARD_FP(func) + #else + #define ANNOTATE_INTRA_FUNCTION_CALL + .macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0 +-- +2.40.1 + diff --git a/queue-5.15/series b/queue-5.15/series index db7b1e1a002..34ab870f04a 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -123,6 +123,8 @@ mmc-f-sdh30-fix-order-of-function-calls-in-sdhci_f_sdh30_remove.patch x86-cpu-fix-__x86_return_thunk-symbol-type.patch x86-cpu-fix-up-srso_safe_ret-and-__x86_return_thunk.patch x86-alternative-make-custom-return-thunk-unconditional.patch +objtool-add-frame-pointer-specific-function-ignore.patch +x86-ibt-add-annotate_noendbr.patch x86-cpu-clean-up-srso-return-thunk-mess.patch x86-cpu-rename-original-retbleed-methods.patch x86-cpu-rename-srso_-.-_alias-to-srso_alias_-1.patch diff --git a/queue-5.15/x86-ibt-add-annotate_noendbr.patch b/queue-5.15/x86-ibt-add-annotate_noendbr.patch new file mode 100644 index 00000000000..680b84c84c3 --- /dev/null +++ b/queue-5.15/x86-ibt-add-annotate_noendbr.patch @@ -0,0 +1,121 @@ +From f3c95380a42cc13f671c4325103c22379c468342 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Mar 2022 16:30:18 +0100 +Subject: x86/ibt: Add ANNOTATE_NOENDBR + +From: Peter Zijlstra + +[ 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) +Reviewed-by: Kees Cook +Acked-by: Josh Poimboeuf +Link: https://lore.kernel.org/r/20220308154317.578968224@infradead.org +Signed-off-by: Sasha Levin +--- + include/linux/objtool.h | 16 ++++++++++++++++ + tools/include/linux/objtool.h | 16 ++++++++++++++++ + 2 files changed, 32 insertions(+) + +diff --git a/include/linux/objtool.h b/include/linux/objtool.h +index d59e69df821eb..51f5b24af8342 100644 +--- a/include/linux/objtool.h ++++ b/include/linux/objtool.h +@@ -82,6 +82,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__ */ + + /* +@@ -134,6 +140,13 @@ struct unwind_hint { + .popsection + .endm + ++.macro ANNOTATE_NOENDBR ++.Lhere_\@: ++ .pushsection .discard.noendbr ++ .quad .Lhere_\@ ++ .popsection ++.endm ++ + #endif /* __ASSEMBLY__ */ + + #else /* !CONFIG_STACK_VALIDATION */ +@@ -144,12 +157,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 type:req sp_reg=0 sp_offset=0 end=0 + .endm + .macro STACK_FRAME_NON_STANDARD func:req + .endm ++.macro ANNOTATE_NOENDBR ++.endm + #endif + + #endif /* CONFIG_STACK_VALIDATION */ +diff --git a/tools/include/linux/objtool.h b/tools/include/linux/objtool.h +index d59e69df821eb..51f5b24af8342 100644 +--- a/tools/include/linux/objtool.h ++++ b/tools/include/linux/objtool.h +@@ -82,6 +82,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__ */ + + /* +@@ -134,6 +140,13 @@ struct unwind_hint { + .popsection + .endm + ++.macro ANNOTATE_NOENDBR ++.Lhere_\@: ++ .pushsection .discard.noendbr ++ .quad .Lhere_\@ ++ .popsection ++.endm ++ + #endif /* __ASSEMBLY__ */ + + #else /* !CONFIG_STACK_VALIDATION */ +@@ -144,12 +157,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 type:req sp_reg=0 sp_offset=0 end=0 + .endm + .macro STACK_FRAME_NON_STANDARD func:req + .endm ++.macro ANNOTATE_NOENDBR ++.endm + #endif + + #endif /* CONFIG_STACK_VALIDATION */ +-- +2.40.1 +