Skip to content

Commit 93f16a1

Browse files
author
Peter Zijlstra
committed
x86/boot: Mark start_secondary() with __noendbr
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) <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 582077c commit 93f16a1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static void ap_calibrate_delay(void)
229229
/*
230230
* Activate a secondary processor.
231231
*/
232-
static void notrace start_secondary(void *unused)
232+
static void notrace __noendbr start_secondary(void *unused)
233233
{
234234
/*
235235
* Don't put *anything* except direct CPU state initialization
@@ -314,6 +314,7 @@ static void notrace start_secondary(void *unused)
314314
wmb();
315315
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
316316
}
317+
ANNOTATE_NOENDBR_SYM(start_secondary);
317318

318319
/*
319320
* The bootstrap kernel entry code has set these up. Save them for

include/linux/objtool.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
#define UNWIND_HINT(type, sp_reg, sp_offset, signal) "\n\t"
129129
#define STACK_FRAME_NON_STANDARD(func)
130130
#define STACK_FRAME_NON_STANDARD_FP(func)
131-
#define __ASM_ANNOTATE(label, type)
131+
#define __ASM_ANNOTATE(label, type) ""
132132
#define ASM_ANNOTATE(type)
133133
#else
134134
.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 signal=0
@@ -147,6 +147,8 @@
147147
* these relocations will never be used for indirect calls.
148148
*/
149149
#define ANNOTATE_NOENDBR ASM_ANNOTATE(ANNOTYPE_NOENDBR)
150+
#define ANNOTATE_NOENDBR_SYM(sym) asm(__ASM_ANNOTATE(sym, ANNOTYPE_NOENDBR))
151+
150152
/*
151153
* This should be used immediately before an indirect jump/call. It tells
152154
* objtool the subsequent indirect jump/call is vouched safe for retpoline

0 commit comments

Comments
 (0)