From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBotA9tKGiK5/+muza6Zd+Qj2si8XuBcUrs7Ff5EJSEKY749MTFQ9zetgwPruDZoYqfsufmKu ARC-Seal: i=1; a=rsa-sha256; t=1514817242; cv=none; d=google.com; s=arc-20160816; b=z282cYmBFonp0IXpAv05hB8msTQx02j8QDPuzK+QIPA1JUwhfcZieGSdL64rMWqVxr dha3iQVh1pFJKY1r/aJQUql+7m+3ntrizKTNjd7//RNIWRVxLxPAHBOSpeO82IQIaAHU Ouq76tpA53LWWWeQZyLh+1ualRlZQ1nm0D7BJ7pduwrehFTdxtsXPnc/4IOSEj59q9rj Huy9hLoHoPLmESCaUMHINz7xvJI+BU6tRDBiLllYletwrqMEnm+n7ZFYMTSPGNAyNihX 5hI3+NNEO+m3PMQZP3veFqyqwl8bXHK0WwT2Rc03yyzOrw/FRlZSSNa9M6JhVO3HxOwV tBeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=DQkYryAv+DJvSlbrzgLCbnYqqmyM3sy3GFyEMi6b5/8=; b=CdNhU4WPd9zCU2QOGzCAZctwgfCukOzqXBaeAo6gqQR06xRHXWerJcdB6ygGx52wij QX7Zx0X2ribBtCA6w8YLOmvv2rRe0gy8/qBI+7HESk6tLXKBE8YihuuHCojXLeKz6as0 K/XyBhuHDM2tDvTiWvbIxnXI7gV7Q35aVADQd0JdHNr6cGqecsnr06ROJYAKd6jaXp79 hkhk7I0itG7AGRnH6U0PZwsQiozloqtcVUiVtDwejRsI3ZwVFhFXuiX+LQpJh057ELVY JCaREWx08SvSJGmXwRKHQjCLLkCioXIUk+ZBI9mWdzfsO1YOcduDUF1gnni+duil7VCC 6zug== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Hansen , Jiri Kosina , Andy Lutomirski , Linus Torvalds Subject: [PATCH 4.9 23/75] kbuild: add -fno-stack-check to kernel build options Date: Mon, 1 Jan 2018 15:32:00 +0100 Message-Id: <20180101140100.209912577@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180101140056.475827799@linuxfoundation.org> References: <20180101140056.475827799@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1588401004090558852?= X-GMAIL-MSGID: =?utf-8?q?1588401004090558852?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-stable 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: Greg Kroah-Hartman --- Makefile | 3 +++ 1 file changed, 3 insertions(+) --- a/Makefile +++ b/Makefile @@ -788,6 +788,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)