diff mbox series

[03/11] objtool: Add asm version of STACK_FRAME_NON_STANDARD

Message ID 20240417235401.243631-4-yuxuan.luo@canonical.com
State New
Headers show
Series CVE-2024-2201 | expand

Commit Message

Yuxuan Luo April 17, 2024, 11:53 p.m. UTC
From: Josh Poimboeuf <jpoimboe@redhat.com>

To be used for adding asm functions to the ignore list.  The "aw" is
needed to help the ELF section metadata match GCC-created sections.
Otherwise the linker creates duplicate sections instead of combining
them.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/8faa476f9a5ac89af27944ec184c89f95f3c6c49.1611263462.git.jpoimboe@redhat.com
(backported from commit 081df94301e317e84c3413686043987da2c3e39d)
[yuxuan.luo: applied changes for include/linux/objtool.h to
include/linux/frame.h.
]
CVE-2024-2201
Signed-off-by: Yuxuan Luo <yuxuan.luo@canonical.com>
---
 include/linux/frame.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/frame.h b/include/linux/frame.h
index d946adb5de178..7046eeeece9b5 100644
--- a/include/linux/frame.h
+++ b/include/linux/frame.h
@@ -29,13 +29,22 @@ 
 	.long 999b;						\
 	.popsection;
 
+.macro STACK_FRAME_NON_STANDARD func:req
+	.pushsection .discard.func_stack_frame_non_standard, "aw"
+		.long \func - .
+	.popsection
+.endm
 #endif /* __ASSEMBLY__ */
 
 #else /* !CONFIG_STACK_VALIDATION */
 
 #define STACK_FRAME_NON_STANDARD(func)
-#define ANNOTATE_INTRA_FUNCTION_CALL
 
+#ifdef __ASSEMBLY__
+#define ANNOTATE_INTRA_FUNCTION_CALL
+.macro STACK_FRAME_NON_STANDARD func:req
+.endm
+#endif /* __ASSEMBLY__ */
 #endif /* CONFIG_STACK_VALIDATION */
 
 #endif /* _LINUX_FRAME_H */