x86/urgent for v5.7-rc6
Subsystems (3)
Hi Linus,
as promised, please pull a single fix for kernels built with gcc10 and stack protector enabled.
Thx.
---
The following changes since commit 2ef96a5bb12be62ef75b5828c0aab838ebb29cb8:
Linux 5.7-rc5 (2020-05-10 15:16:58 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tags/x86_urgent_for_v5.7-rc7
for you to fetch changes up to a9a3ed1eff3601b63aea4fb462d8b3b92c7c1e7e:
x86: Fix early boot crash on gcc-10, third try (2020-05-15 11:48:01 +0200)
----------------------------------------------------------------
A single fix for early boot crashes of kernels built with gcc10 and stack protector enabled.
----------------------------------------------------------------
Borislav Petkov (1):
x86: Fix early boot crash on gcc-10, third try
arch/x86/include/asm/stackprotector.h | 7 ++++++- arch/x86/kernel/smpboot.c | 8 ++++++++ arch/x86/xen/smp_pv.c | 1 + include/linux/compiler.h | 6 ++++++ init/main.c | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-)
arch/x86/include/asm/stackprotector.h +6 -1
@@ -55,8 +55,13 @@/* * Initialize the stackprotector canary value. * -* NOTE: this must only be called from functions that never return, +* NOTE: this must only be called from functions that never return * and it must always be inlined. +* +* In addition, it should be called from a compilation unit for which +* stack protector is disabled. Alternatively, the caller should not end +* with a function call which gets tail-call optimized as that would +* lead to checking a modified canary value. */ static __always_inline void boot_init_stack_canary(void) {
arch/x86/kernel/smpboot.c +8 -0
@@ -266,6 +266,14 @@ static void notrace start_secondary(void *unused)wmb ();cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); + +/* +* Prevent tail call to cpu_startup_entry() because the stack protector +* guard has been changed a couple of function calls up, in +* boot_init_stack_canary() and must not be checked before tail calling +* another function. +*/ +prevent_tail_call_optimization (); }/**
arch/x86/xen/smp_pv.c +1 -0
@@ -93,6 +93,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void)cpu_bringup ();boot_init_stack_canary ();cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); +prevent_tail_call_optimization (); }void xen_smp_intr_free_pv (unsigned int cpu)
include/linux/compiler.h +6 -0
@@ -356,4 +356,10 @@ static inline void *offset_to_ptr(const int *off)/* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array (a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +/* +* This is needed in functions which generate the stack canary, see +* arch/x86/kernel/smpboot.c::start_secondary() for an example. +*/ +#define prevent_tail_call_optimization () mb() +#endif /* __LINUX_COMPILER_H */
init/main.c +2 -0
@@ -1036,6 +1036,8 @@ asmlinkage __visible void __init start_kernel(void)/* Do the rest non-__init'ed, we're now alive */ arch_call_rest_init (); + +prevent_tail_call_optimization (); }/* Call all constructor functions linked into the kernel. */
Signature · 4 lines
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG NürnbergThe pull request you sent on Sun, 17 May 2020 11:04:04 +0200:
The pull request you sent on Sun, 17 May 2020 11:04:04 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittags/x86_urgent_for_v5.7-rc7
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/43567139f5f3808cda4f61c956576f8a4f2232cb
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker