aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-02-13 16:43:28 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-02-14 17:33:21 -0500
commite06b8b98da071f7dd78fb7822991694288047df0 (patch)
treef948b3f6ee9303bcce76e6500f0aba335b8b1d0e /Makefile
parent587c90616a5b44e6ccfac38e64d4fecee51d588c (diff)
kbuild: allow -fstack-protector to take effect
Arjan van de Ven <arjan@infradead.org> wrote: === I just read the excellent LWN writeup of the vmsplice security thing, and that got me wondering why this attack wasn't stopped by the CONFIG_CC_STACKPROTECTOR option... because it plain should have been... Some analysis later.. it turns out that the following line in the top level Makefile, added by you in October 2007, entirely disables CONFIG_CC_STACKPROTECTOR ;( With this line removed the exploit will be nicely stopped. CFLAGS += $(call cc-option, -fno-stack-protector) Now I realize that certain distros have patched gcc to compensate for their lack of distro wide CFLAGS, and it's great to work around that... but would there be a way to NOT disable this for CONFIG_CC_STACKPROTECTOR please? It would have made this exploit not possible for those kernels that enable this feature (and that includes distros like Fedora) === Move the assignment to KBUILD_CFLAGS up before including the arch specific Makefile so arch makefiles may override the setting. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Arjan van de Ven <arjan@infradead.org> Cc: stable@kernel.org
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 4 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c162370c7367..d73865188372 100644
--- a/Makefile
+++ b/Makefile
@@ -507,6 +507,10 @@ else
507KBUILD_CFLAGS += -O2 507KBUILD_CFLAGS += -O2
508endif 508endif
509 509
510# Force gcc to behave correct even for buggy distributions
511# Arch Makefiles may override this setting
512KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
513
510include $(srctree)/arch/$(SRCARCH)/Makefile 514include $(srctree)/arch/$(SRCARCH)/Makefile
511 515
512ifdef CONFIG_FRAME_POINTER 516ifdef CONFIG_FRAME_POINTER
@@ -525,9 +529,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
525KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) 529KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
526endif 530endif
527 531
528# Force gcc to behave correct even for buggy distributions
529KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
530
531# arch Makefile may override CC so keep this after arch Makefile is included 532# arch Makefile may override CC so keep this after arch Makefile is included
532NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 533NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
533CHECKFLAGS += $(NOSTDINC_FLAGS) 534CHECKFLAGS += $(NOSTDINC_FLAGS)