From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBovpRBWPKHaBLlsQgb5Yg+YCpk2kboRxNG1CEn5uyOnVFuiX1dfgkLb9XhtCTssGWj6r06GD ARC-Seal: i=1; a=rsa-sha256; t=1514817724; cv=none; d=google.com; s=arc-20160816; b=bLuWYFPelvfzes4ymnZNKM2QkZvfzmcyTGBKAPSIaB9JbuE5PUvKbg/b2LoTa+z2IX ogLbw9ofNXXY1KwKPvVFAelYqYqTXAI0R3ko61IqNkd3gWw7k0iK4mWAhvkksSYOAZVR jEkroUdYI3lZvC/Ky/YpzdFe+Cdr6GhddLISCkNcbi/KHupNhJrQOYc+lnCtQlRH1rHX foF4AI65nnbVV++bp+uYNmApFKTPzM+Gad94JucQl8QhOIiHlvbUjYoARHOEcWRG6on/ RcarIQpOMYsFULBi3c8XpG5+Mjvfq1HLZyU7kQOFe4u38DyiVFeIRS9sblHkwDo/1j2D XHVQ== 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=HQCXOmS+covFQ5k/UuyNYp40wNa2rIOhwgqIK9MZr1U=; b=nVYrofU8tpcfqp7SVnoeQ4iQbDySivJbjFom4Xd9J+goeuvtlPlOH1N5/TGX7+pSvq CyseT7hCk+fot18b7bZQWOLGrD/rf4OqlHXP68Hyxdna2fgXTLmNm9WcDRwrErvcAONl PRxUYGoRDgmSyn75TDo2VKkEbC4gw+vsc7a9/qHluPW16lSi0GB+Rt0XpZJ3K8coAz4v 19tApDXbgLUzoQCOhcHbezTeFr1ypUNUl/2rehjvpaw48KDPToiYwww9T0AZyyH6GuF+ eCg09A1YUihYkrmmY9ovrjMFi3tK4bLtVx7llxANbmD0JmzHyXZ2Wzu4QIBlWxyiM1qh Ywbw== 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.14 058/146] kbuild: add -fno-stack-check to kernel build options Date: Mon, 1 Jan 2018 15:37:29 +0100 Message-Id: <20180101140132.597863312@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180101140123.743014891@linuxfoundation.org> References: <20180101140123.743014891@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?1588401510265501176?= X-GMAIL-MSGID: =?utf-8?q?1588401510265501176?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-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 @@ -802,6 +802,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)