summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2021-02-23 08:24:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-17 09:29:33 +0100
commita1c1b4353c261d427b7a0d88ceccd61718f2031c (patch)
tree4f97a350faa1d04fbf4c49297401ca2ddf101e18 /Makefile
parent6e9d25d24629d5ea7675503625f6179b0ef6a9f6 (diff)
downloadbarebox-a1c1b4353c261d427b7a0d88ceccd61718f2031c.tar.gz
barebox-a1c1b4353c261d427b7a0d88ceccd61718f2031c.tar.xz
kbuild: add '-fno-stack-check' to barebox build options
This ports over Linux commit 3ce120b16cc5 ("kbuild: add '-fno-stack-check' to kernel build options"): Author: Linus Torvalds <torvalds@linux-foundation.org> 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 <torvalds@linux-foundation.org> I am porting it, because it may become more acute with the incoming support for multiple stacks (via initjmp). Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6d44314f0a..b01afb37ac 100644
--- a/Makefile
+++ b/Makefile
@@ -630,6 +630,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