Received: by 10.223.185.116 with SMTP id b49csp6394857wrg; Wed, 28 Feb 2018 08:42:08 -0800 (PST) X-Google-Smtp-Source: AH8x227PlLtjLFWXGNmQmQMkoeaMeIifn5cJhfUBdDk8xX3srJfby96fxhRPbhaf4Us+k5WD6HYB X-Received: by 10.99.160.17 with SMTP id r17mr13383906pge.127.1519836128146; Wed, 28 Feb 2018 08:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836128; cv=none; d=google.com; s=arc-20160816; b=0M674fizQ3yEIJWfEqX4hY65E6RJkUwfq0xRZ2pCYi+U0+avHhhTuad9t+ugCMIqDD odTaFMq0zgwxjeF98+BnPkSOz008qqzNL7ABNTosNXW4TAz/UswzAL/G990ZJJYMjTcR RBEzyZo45Qvlzk205Ao2WLOOvkdr5XRTCXoXca95n85FCJZjTz3ft/QAOxZXhbbV0RK3 M9nlo1oE1rQixkxv/ZqA4RKOP5/or+olJ33Zwnc/2YTHt7RaXtQuLj0zjZ4BBcHECoEl +5dvcyUdW1rjP5zGujxo9lYdJAFQ56b/bLfiSqDmDfBPZ/DVL3auuMkkhL3ZsDfSPzbp msaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=DudJn+aIZ+bWruXXxZ2VabkSgS+sfAqJXC/RBpqppys=; b=PbkopfaEQ+VArSiCxWU0fkgydFYlPxaq2bIyihP5xtY2e457aNK5arBNqUJ8T7InZ8 U/O9O0IaJYkBNKTDanx5/AEN8i9M8Jpg84C9XqE+13oANZuuVWc0+l0xfgmmN3WRep9s 2GBjAVLB09u0zbdb9J+Fs+1DaBUUX5xroddGBVQe4wGJ9/XSLiNI0qJhkwOOA4sb+yh7 +NuVD1Tlubs2EabQTKTN/VlsWUsMZmg01BHMQD7bNW4fufK/MTMwVklA1b9bbJ/d139p Kz+ZMZwlnGaGx6lDFhxqu7SbwSKxaivpL5lZ10Sga5Ur8H8ZfQxe1NkZsqwkZRGBPV1z PB+g== 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 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si1211299pgv.424.2018.02.28.08.41.53; Wed, 28 Feb 2018 08:42:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933379AbeB1QDj (ORCPT + 99 others); Wed, 28 Feb 2018 11:03:39 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34775 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932318AbeB1QDf (ORCPT ); Wed, 28 Feb 2018 11:03:35 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yr-0006Xd-K8; Wed, 28 Feb 2018 15:22:29 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yi-0000AX-2u; Wed, 28 Feb 2018 15:22:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Linus Torvalds" , "Jiri Kosina" , "Dave Hansen" , "Andy Lutomirski" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 152/254] kbuild: add '-fno-stack-check' to kernel build options In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Linus Torvalds commit 3ce120b16cc548472f80cf8644f90eda958cf1b6 upstream. It appears that hardened gentoo enables "-fstack-check" by default for gcc. That doesn't work _at_all_ for the kernel, because the kernel stack doesn't act like a user stack at all: it's much smaller, and it doesn't auto-expand on use. So the extra "probe one page below the stack" code generated by -fstack-check just breaks the kernel in horrible ways, causing infinite double faults etc. [ I have to say, that the particular code gcc generates looks very stupid even for user space where it works, but that's a separate issue. ] Reported-and-tested-by: Alexander Tsoy Reported-and-tested-by: Toralf Förster Cc: Dave Hansen Cc: Jiri Kosina Cc: Andy Lutomirski Signed-off-by: Linus Torvalds Signed-off-by: Ben Hutchings --- Makefile | 3 +++ 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile @@ -736,6 +736,9 @@ KBUILD_CFLAGS += $(call cc-disable-warni # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) +# Make sure -fstack-check isn't enabled (like gentoo apparently did) +KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,) + # conserve stack if available KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)