From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBosd7jzprER+k4pGi6H0jiJMUfE7oFl8p6/xN3Zn3XxxKUnAov80mJxku9fg5PAMj+9kyV6V ARC-Seal: i=1; a=rsa-sha256; t=1514816813; cv=none; d=google.com; s=arc-20160816; b=hvE0HbRofE4DPAdG9ioQTo1VgKDkyG2ZDz9mTUg2SksP4HokJkOJkDfPsELw++8RNg qBt4yKrxwhEecfTmOjbXX5mJDACEAiVx1KT8JHOZBfojhrUytO2Od+Gt065jI7ghCGxk 8GqG4s5u2N+nqmQVQPfywYMbGeHN4OkzMKW7aGvuLbwXYexw+p4C2mRdQ1YPeANxIPYx Np9/sWAkKPt/QEdfaxb1XCAbXfZO7NR93/A0m/1VN+2KJ+BSx3/cDcUL8vKwzB1Z8N1y k7U+nXeZwUhKckPZMV7LRL2X3aOt2AkcEl0JLsTW1T+ueGZj4255kaw8Fefcq4vM7XMh 7iRg== 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=dMhtpCD/LWJn5gtp/9W9aTm7aItnmVvoU4X2dddOiBw=; b=vYUH7AcVTD/Vsnq+pqF0JT3DrwDKkGAUydM22IHUm9U7LRgbY8vayGvNGmlwGo+InT YFiv/XIP0A0gePr9YBCYqXZOxjC57UjFsJVu97DI04NYE4xwmSzT87USw1CFBt18ClOD d6aU0mcK5y9NDaCAdhRxY8KCeMWp0gJQmF8VACmWSWGYomefI/vWNyHDkddwnM2LhNul haW9rF+nhU9ix2oFPEGKq5z84nL8jykpmvGIqldzSLfiPerlYZRl5hcsdDxxmEc5MeQK SoPI917hI0hHtGL1FTCMp3RBuKMfTmJ4ILxOYDWWg37QJoYYb1hsGReEO7wJ0rF/osC6 T+Rg== 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.4 33/63] kbuild: add -fno-stack-check to kernel build options Date: Mon, 1 Jan 2018 15:24:51 +0100 Message-Id: <20180101140048.154431909@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180101140042.456380281@linuxfoundation.org> References: <20180101140042.456380281@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?1588400555087862616?= X-GMAIL-MSGID: =?utf-8?q?1588400555087862616?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-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 @@ -782,6 +782,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)