kbuild: allow -fstack-protector to take effect
authorSam Ravnborg <sam@ravnborg.org>
Wed, 13 Feb 2008 21:43:28 +0000 (22:43 +0100)
committerSam Ravnborg <sam@ravnborg.org>
Thu, 14 Feb 2008 22:33:21 +0000 (23:33 +0100)
commite06b8b98da071f7dd78fb7822991694288047df0
treef948b3f6ee9303bcce76e6500f0aba335b8b1d0e
parent587c90616a5b44e6ccfac38e64d4fecee51d588c
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
Makefile