Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4621982ybb; Tue, 14 Apr 2020 10:51:37 -0700 (PDT) X-Google-Smtp-Source: APiQypIB3xcuRbVQyRGAxflVY+K2jtfE3RG0PGRaZHzyoneqG4QbZaULDwUajOWpqJvqmx4l6LcI X-Received: by 2002:a50:eac7:: with SMTP id u7mr13550098edp.190.1586886697649; Tue, 14 Apr 2020 10:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586886697; cv=none; d=google.com; s=arc-20160816; b=WQpdyqiwMXd34XCb5ONXdKHNHXPjM4XgUvsXgb0T2RANR8F6zA4h2eqi6SsaOrpd3W rrlOAIVj0Gps+h09y0CyIar+VOoXZ4SX/Y1S1kUoqJyV0OkBJFvQAvtHzhFPgD0Kmzh7 mbfFNKFoqsSIvARlcO/KrvGZUcj6gyYka91xdWQ5mN9AS87j29ytT0Q3+5/A/cMN4d3m umEajeQKrnaB3AJx0vcUjEbkuHQRw9eXbJrhI8ayN1qcvZoFnoHPJmf72wjYCNV96oAW 4MuDknX8V9QllOUTnOi/pT5xkSYOTfqp67WPT22on2kq/5t4dxOUwNgAyFg3wkLr0BPL sKPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=4ClumGFCbvXxw3eO7BzSfdbNMgseEndUd4X86rSwWow=; b=cEt/2CjwEP4Dhp08r5pkID2B9fxwYDPDJ5G1rb4WE2RtJ7axBqv5pRisDe0FRqT6P5 JYBUeitUQcEwVhwo/WsVPKvgRrQBLJ4tcWM0uq9rBmIdPUDcLEGz2Soeb1+V4hcnirTb zhIcDnNEKjusRtpI8TuPyPvkrtxO9WHBZLosaioipofWyWO31MdVr2LfsvjK8MWbt6ds 8iqaHr3cCGxNW3ihYxYLY6R8x49UJKfH4/9R3LludLjxVjChRNyrQVGTkeBg2JJMsyQM TFfLP1eu/pQk+duRfTfcgy0+tALCHyEtvLqMMkcu4Fdy/dAwyYyLvev77f7gHydNXLjc QhVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a30si9462967edb.143.2020.04.14.10.51.13; Tue, 14 Apr 2020 10:51:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730474AbgDMOQQ convert rfc822-to-8bit (ORCPT + 99 others); Mon, 13 Apr 2020 10:16:16 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40358 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730466AbgDMOQO (ORCPT ); Mon, 13 Apr 2020 10:16:14 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jNzsW-00021U-Nm; Mon, 13 Apr 2020 16:16:00 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 4B5751C0092; Mon, 13 Apr 2020 16:16:00 +0200 (CEST) Date: Mon, 13 Apr 2020 14:15:59 -0000 From: "tip-bot2 for Sergei Trofimovich" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86: Fix early boot crash on gcc-10 Cc: Sergei Trofimovich , Borislav Petkov , Jakub Jelinek , Michael Matz , x86 , LKML In-Reply-To: <20200328084858.421444-1-slyfox@gentoo.org> References: <20200328084858.421444-1-slyfox@gentoo.org> MIME-Version: 1.0 Message-ID: <158678735989.28353.17058422416826993351.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 AuthorDate: Sat, 28 Mar 2020 08:48:58 Committer: Borislav Petkov 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 Signed-off-by: Borislav Petkov Cc: Jakub Jelinek Cc: Michael Matz 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