]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fix up build errors on 5.15
authorSasha Levin <sashal@kernel.org>
Tue, 22 Aug 2023 03:04:25 +0000 (23:04 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 22 Aug 2023 03:04:38 +0000 (23:04 -0400)
queue-5.15/objtool-add-frame-pointer-specific-function-ignore.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/x86-ibt-add-annotate_noendbr.patch [new file with mode: 0644]

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 (file)
index 0000000..c6495d4
--- /dev/null
@@ -0,0 +1,91 @@
+From 88b19a0e5cbc59720e4c808689ea87c3fa140acf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 Sep 2021 23:41:13 +0900
+Subject: objtool: Add frame-pointer-specific function ignore
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+[ 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 <jpoimboe@redhat.com>
+Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
+Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Stable-dep-of: c8c301abeae5 ("x86/ibt: Add ANNOTATE_NOENDBR")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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
+
index db7b1e1a00224582c1adbc2a880cd5bcceae2a74..34ab870f04aa636d4a156b7d3fd976328bfa3215 100644 (file)
@@ -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 (file)
index 0000000..680b84c
--- /dev/null
@@ -0,0 +1,121 @@
+From f3c95380a42cc13f671c4325103c22379c468342 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Mar 2022 16:30:18 +0100
+Subject: x86/ibt: Add ANNOTATE_NOENDBR
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+[ 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>
+---
+ 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
+