From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lES3j-0003Xn-Eu for barebox@lists.infradead.org; Tue, 23 Feb 2021 07:24:40 +0000 Received: from geraet.fritz.box (unknown [87.123.107.144]) (Authenticated sender: ahmad@a3f.at) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id EDA951BF205 for ; Tue, 23 Feb 2021 07:24:31 +0000 (UTC) From: Ahmad Fatoum Date: Tue, 23 Feb 2021 08:24:26 +0100 Message-Id: <20210223072427.166689-1-ahmad@a3f.at> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 1/2] kbuild: add '-fno-stack-check' to barebox build options To: barebox@lists.infradead.org This ports over Linux commit 3ce120b16cc5 ("kbuild: add '-fno-stack-check' to kernel build options"): Author: Linus Torvalds kbuild: add '-fno-stack-check' to kernel build options 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. ] Signed-off-by: Linus Torvalds I am porting it, because it may become more acute with the incoming support for multiple stacks (via initjmp). Signed-off-by: Ahmad Fatoum --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f3c85cff9430..fa7fbbeb35f0 100644 --- a/Makefile +++ b/Makefile @@ -622,6 +622,9 @@ KBUILD_CFLAGS += $(call cc-option, -fno-delete-null-pointer-checks,) # 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) + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) # Align the bit size of userspace programs with the kernel -- 2.30.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox