]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
[DO NOT MERGE] x86/kexec: Add CFI type information to relocate_kernel() kexec-debug-8
authorDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 16 Dec 2024 10:26:24 +0000 (10:26 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 14 Mar 2025 17:16:23 +0000 (17:16 +0000)
A previous commit added __nocfi to machine_kexec() because it makes an
indirect call to relocate_kernel() which lacked CFI type information,
and caused the system to crash.

Use SYM_TYPED_FUNC_START() to ensure that the type information is
present, and remove the __nocfi tag.

I still can't make objtool happy with this in both GCC and Clang builds
at the same time, so not yet for merging; only included in this series
to nerd-snipe the objtool maintainers.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
arch/x86/kernel/machine_kexec_64.c
arch/x86/kernel/relocate_kernel_64.S

index 7abc7aa0261b2e4bdfcaec5636e57010ca071ef2..84f59f18dcb6be5ea3e618dd080a1c4f839d242c 100644 (file)
@@ -380,7 +380,7 @@ void machine_kexec_cleanup(struct kimage *image)
  * Do not allocate memory (or fail in any way) in machine_kexec().
  * We are past the point of no return, committed to rebooting now.
  */
-void __nocfi machine_kexec(struct kimage *image)
+void machine_kexec(struct kimage *image)
 {
        unsigned long reloc_start = (unsigned long)__relocate_kernel_start;
        relocate_kernel_fn *relocate_kernel_ptr;
index 228301ac66e9ad429894031b557b52446ca9b867..dbcef343028539f22145f766bd812518cc2fdc01 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/cfi_types.h>
 #include <linux/stringify.h>
 #include <asm/alternative.h>
 #include <asm/page_types.h>
@@ -59,8 +60,9 @@ SYM_DATA_END(kexec_debug_idt)
 
        .section .text..relocate_kernel,"ax";
        .code64
-SYM_CODE_START_NOALIGN(relocate_kernel)
+SYM_TYPED_FUNC_START(relocate_kernel)
        UNWIND_HINT_END_OF_STACK
+       UNWIND_HINT_FUNC
        ANNOTATE_NOENDBR
        /*
         * %rdi indirection_page