From: "tip-bot2 for Sergei Trofimovich" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sergei Trofimovich <slyfox@gentoo.org>,
Borislav Petkov <bp@suse.de>, Jakub Jelinek <jakub@redhat.com>,
Michael Matz <matz@suse.de>, x86 <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [tip: x86/urgent] x86: Fix early boot crash on gcc-10
Date: Mon, 13 Apr 2020 14:15:59 -0000 [thread overview]
Message-ID: <158678735989.28353.17058422416826993351.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200328084858.421444-1-slyfox@gentoo.org>
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 5871c72d659e5c312b9ad635034cab59f7786a98
Gitweb: https://git.kernel.org/tip/5871c72d659e5c312b9ad635034cab59f7786a98
Author: Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: Sat, 28 Mar 2020 08:48:58
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 13 Apr 2020 16:07:35 +02:00
x86: Fix early boot crash on gcc-10
Fix a boot failure where the kernel is built with gcc-10 with stack
protector enabled by default:
Kernel panic — not syncing: stack-protector: Kernel stack is corrupted in: start_secondary
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.6.0-rc5—00235—gfffb08b37df9 #139
Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77M—D3H, BIOS F12 11/14/2013
Call Trace:
dump_stack
panic
? start_secondary
__stack_chk_fail
start_secondary
secondary_startup_64
-—-[ end Kernel panic — not syncing: stack—protector: Kernel stack is corrupted in: start_secondary
This happens because start_secondary() is responsible for setting
up initial stack canary value in smpboot.c but nothing prevents gcc
from inserting stack canary into start_secondary() itself before the
boot_init_stack_canary() call which sets up said canary value.
Inhibit the stack canary addition for start_secondary() only.
[ bp: Massage a bit. ]
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Michael Matz <matz@suse.de>
Link: https://lkml.kernel.org/r/20200328084858.421444-1-slyfox@gentoo.org
---
arch/x86/kernel/smpboot.c | 6 +++++-
include/linux/compiler-gcc.h | 1 +
include/linux/compiler_types.h | 4 ++++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index fe3ab96..9ea28e5 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -209,10 +209,14 @@ static void smp_callin(void)
static int cpu0_logical_apicid;
static int enable_start_cpu0;
+
/*
* Activate a secondary processor.
+ *
+ * Note: boot_init_stack_canary() sets up the canary value so omit the stack
+ * canary creation for this function only.
*/
-static void notrace start_secondary(void *unused)
+static void __no_stack_protector notrace start_secondary(void *unused)
{
/*
* Don't put *anything* except direct CPU state initialization
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index d7ee4c6..fb67c74 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -172,3 +172,4 @@
#endif
#define __no_fgcse __attribute__((optimize("-fno-gcse")))
+#define __no_stack_protector __attribute__((optimize("-fno-stack-protector")))
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index e970f97..069c981 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -203,6 +203,10 @@ struct ftrace_likely_data {
#define asm_inline asm
#endif
+#ifndef __no_stack_protector
+# define __no_stack_protector
+#endif
+
#ifndef __no_fgcse
# define __no_fgcse
#endif
next prev parent reply other threads:[~2020-04-13 14:16 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-14 16:44 [PATCH] x86: fix early boot crash on gcc-10 Sergei Trofimovich
2020-03-16 13:04 ` Peter Zijlstra
2020-03-16 13:26 ` Jakub Jelinek
2020-03-16 13:42 ` Peter Zijlstra
2020-03-16 17:54 ` Borislav Petkov
2020-03-16 18:03 ` Jakub Jelinek
2020-03-17 14:36 ` Borislav Petkov
2020-03-17 14:39 ` Jakub Jelinek
2020-03-17 14:49 ` Borislav Petkov
2020-03-17 16:35 ` David Laight
2020-03-25 13:31 ` Borislav Petkov
2020-03-26 21:54 ` Sergei Trofimovich
2020-03-26 22:35 ` Borislav Petkov
2020-03-28 8:48 ` [PATCH v2] " Sergei Trofimovich
2020-04-13 14:15 ` tip-bot2 for Sergei Trofimovich [this message]
2020-04-13 16:35 ` Borislav Petkov
2020-04-14 13:50 ` Michael Matz
2020-04-15 7:48 ` Borislav Petkov
2020-04-15 14:53 ` Michael Matz
2020-04-15 22:19 ` Sergei Trofimovich
2020-04-17 7:57 ` Borislav Petkov
2020-04-17 8:07 ` Jakub Jelinek
2020-04-17 8:42 ` Borislav Petkov
2020-04-17 8:58 ` Jakub Jelinek
2020-04-17 9:09 ` Borislav Petkov
2020-04-17 18:15 ` Nick Desaulniers
2020-04-17 18:22 ` Nick Desaulniers
2020-04-17 19:06 ` Jakub Jelinek
2020-04-17 19:49 ` Nick Desaulniers
2020-04-17 19:53 ` Nick Desaulniers
2020-04-20 14:04 ` Michael Matz
2020-04-22 10:23 ` Borislav Petkov
2020-04-22 11:40 ` Peter Zijlstra
2020-04-22 13:49 ` Borislav Petkov
2020-04-22 13:55 ` Jakub Jelinek
2020-04-22 14:16 ` Martin Liška
2020-04-22 15:06 ` Michael Matz
2020-04-22 16:53 ` Borislav Petkov
2020-04-22 17:02 ` Jakub Jelinek
2020-04-22 18:47 ` Nick Desaulniers
2020-04-22 18:55 ` Nick Desaulniers
2020-04-22 19:21 ` Borislav Petkov
2020-04-22 21:05 ` Nick Desaulniers
2020-04-22 21:26 ` Borislav Petkov
2020-04-22 22:57 ` Nick Desaulniers
2020-04-23 12:53 ` Borislav Petkov
2020-04-23 16:12 ` [PATCH] x86: Fix early boot crash on gcc-10, next try Borislav Petkov
2020-04-23 17:30 ` Borislav Petkov
2020-04-23 18:02 ` Nick Desaulniers
2020-04-23 18:27 ` Borislav Petkov
2020-04-27 11:37 ` [tip: x86/build] x86/build: Check whether the compiler is sane tip-bot2 for Borislav Petkov
2020-04-23 19:40 ` [PATCH] x86: Fix early boot crash on gcc-10, next try Kees Cook
2020-04-25 1:46 ` Arvind Sankar
2020-04-25 8:57 ` Borislav Petkov
2020-04-25 11:09 ` Jürgen Groß
2020-04-25 15:04 ` Arvind Sankar
2020-04-25 15:04 ` Arvind Sankar
2020-04-25 17:31 ` Borislav Petkov
2020-04-25 17:31 ` Borislav Petkov
2020-04-25 17:52 ` Borislav Petkov
2020-04-25 17:52 ` Borislav Petkov
2020-04-27 17:07 ` David Laight
2020-04-27 17:07 ` David Laight
2020-04-25 18:37 ` Segher Boessenkool
2020-04-25 18:37 ` Segher Boessenkool
2020-04-25 18:53 ` Borislav Petkov
2020-04-25 18:53 ` Borislav Petkov
2020-04-25 19:15 ` Segher Boessenkool
2020-04-25 19:15 ` Segher Boessenkool
2020-04-25 22:17 ` Borislav Petkov
2020-04-25 22:17 ` Borislav Petkov
2020-04-25 22:25 ` Arvind Sankar
2020-04-25 22:25 ` Arvind Sankar
2020-04-17 10:38 ` [PATCH v2] x86: fix early boot crash on gcc-10 Peter Zijlstra
2020-04-18 13:12 ` David Laight
2020-04-17 10:41 ` Peter Zijlstra
2020-03-16 18:20 ` [PATCH] " Arvind Sankar
2020-03-16 18:54 ` Arvind Sankar
2020-03-16 19:53 ` Arvind Sankar
2020-03-16 20:08 ` Jakub Jelinek
2020-03-16 20:40 ` Arvind Sankar
2020-03-16 22:12 ` Sergei Trofimovich
2020-03-17 11:46 ` Jakub Jelinek
2020-03-17 18:10 ` Sergei Trofimovich
2020-03-16 18:22 ` Arvind Sankar
2020-03-26 23:16 ` [PATCH v2] " Sergei Trofimovich
2020-04-27 11:37 ` [tip: x86/build] x86: Fix early boot crash on gcc-10, next try tip-bot2 for Borislav Petkov
2020-05-15 11:20 ` [tip: x86/urgent] x86: Fix early boot crash on gcc-10, third try tip-bot2 for Borislav Petkov
2020-05-19 11:49 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=158678735989.28353.17058422416826993351.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@suse.de \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=matz@suse.de \
--cc=slyfox@gentoo.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.