Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86_urgent_for_v5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fix from Borislav Petkov:
"A single fix for early boot crashes of kernels built with gcc10 and
stack protector enabled"

* tag 'x86_urgent_for_v5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: Fix early boot crash on gcc-10, third try

+23 -1
+6 -1
arch/x86/include/asm/stackprotector.h
··· 55 55 /* 56 56 * Initialize the stackprotector canary value. 57 57 * 58 - * NOTE: this must only be called from functions that never return, 58 + * NOTE: this must only be called from functions that never return 59 59 * and it must always be inlined. 60 + * 61 + * In addition, it should be called from a compilation unit for which 62 + * stack protector is disabled. Alternatively, the caller should not end 63 + * with a function call which gets tail-call optimized as that would 64 + * lead to checking a modified canary value. 60 65 */ 61 66 static __always_inline void boot_init_stack_canary(void) 62 67 {
+8
arch/x86/kernel/smpboot.c
··· 266 266 267 267 wmb(); 268 268 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); 269 + 270 + /* 271 + * Prevent tail call to cpu_startup_entry() because the stack protector 272 + * guard has been changed a couple of function calls up, in 273 + * boot_init_stack_canary() and must not be checked before tail calling 274 + * another function. 275 + */ 276 + prevent_tail_call_optimization(); 269 277 } 270 278 271 279 /**
+1
arch/x86/xen/smp_pv.c
··· 93 93 cpu_bringup(); 94 94 boot_init_stack_canary(); 95 95 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); 96 + prevent_tail_call_optimization(); 96 97 } 97 98 98 99 void xen_smp_intr_free_pv(unsigned int cpu)
+6
include/linux/compiler.h
··· 356 356 /* &a[0] degrades to a pointer: a different type from an array */ 357 357 #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) 358 358 359 + /* 360 + * This is needed in functions which generate the stack canary, see 361 + * arch/x86/kernel/smpboot.c::start_secondary() for an example. 362 + */ 363 + #define prevent_tail_call_optimization() mb() 364 + 359 365 #endif /* __LINUX_COMPILER_H */
+2
init/main.c
··· 1038 1038 1039 1039 /* Do the rest non-__init'ed, we're now alive */ 1040 1040 arch_call_rest_init(); 1041 + 1042 + prevent_tail_call_optimization(); 1041 1043 } 1042 1044 1043 1045 /* Call all constructor functions linked into the kernel. */