]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/boot: Mark start_secondary() with __noendbr
authorPeter Zijlstra <peterz@infradead.org>
Fri, 7 Feb 2025 12:15:34 +0000 (13:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:23 +0000 (11:13 +0200)
[ Upstream commit 93f16a1ab78ca56e3cd997d1ea54c214774781ac ]

The handoff between the boot stubs and start_secondary() are before IBT is
enabled and is definitely not subject to kCFI. As such, suppress all that for
this function.

Notably when the ENDBR poison would become fatal (ud1 instead of nop) this will
trigger a tripple fault because we haven't set up the IDT to handle #UD yet.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20250207122546.509520369@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/smpboot.c
include/linux/objtool.h

index 3d5069ee297bf906a6d184ccd17e403a2b302e70..463634b138bbb8aa23a9bccdaa44c76a8bee68ff 100644 (file)
@@ -229,7 +229,7 @@ static void ap_calibrate_delay(void)
 /*
  * Activate a secondary processor.
  */
-static void notrace start_secondary(void *unused)
+static void notrace __noendbr start_secondary(void *unused)
 {
        /*
         * Don't put *anything* except direct CPU state initialization
@@ -314,6 +314,7 @@ static void notrace start_secondary(void *unused)
        wmb();
        cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
 }
+ANNOTATE_NOENDBR_SYM(start_secondary);
 
 /*
  * The bootstrap kernel entry code has set these up. Save them for
index c722a921165ba38f92f8bedb7891470e6e2f7035..3ca965a2ddc8082b316303c9bbc54240785a2784 100644 (file)
 #define UNWIND_HINT(type, sp_reg, sp_offset, signal) "\n\t"
 #define STACK_FRAME_NON_STANDARD(func)
 #define STACK_FRAME_NON_STANDARD_FP(func)
-#define __ASM_ANNOTATE(label, type)
+#define __ASM_ANNOTATE(label, type) ""
 #define ASM_ANNOTATE(type)
 #else
 .macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 signal=0
  * these relocations will never be used for indirect calls.
  */
 #define ANNOTATE_NOENDBR               ASM_ANNOTATE(ANNOTYPE_NOENDBR)
+#define ANNOTATE_NOENDBR_SYM(sym)      asm(__ASM_ANNOTATE(sym, ANNOTYPE_NOENDBR))
+
 /*
  * This should be used immediately before an indirect jump/call. It tells
  * objtool the subsequent indirect jump/call is vouched safe for retpoline