diff options
author | Kees Cook <keescook@chromium.org> | 2014-08-06 19:03:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-06 21:01:12 -0400 |
commit | 1332429b305044aa75163399ae960c6535828ce6 (patch) | |
tree | 22efa40e700b98b423bdc2145f9581a611ea101f /Makefile | |
parent | 5838d4442bd5971687b72221736222637e03140d (diff) |
./Makefile: explain stack-protector-strong CONFIG logic
This adds a hopefully helpful comment above the (seemingly weird) compiler
flag selection logic.
Signed-off-by: Kees Cook <keescook@chromium.org>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -636,6 +636,22 @@ KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) | |||
636 | endif | 636 | endif |
637 | 637 | ||
638 | # Handle stack protector mode. | 638 | # Handle stack protector mode. |
639 | # | ||
640 | # Since kbuild can potentially perform two passes (first with the old | ||
641 | # .config values and then with updated .config values), we cannot error out | ||
642 | # if a desired compiler option is unsupported. If we were to error, kbuild | ||
643 | # could never get to the second pass and actually notice that we changed | ||
644 | # the option to something that was supported. | ||
645 | # | ||
646 | # Additionally, we don't want to fallback and/or silently change which compiler | ||
647 | # flags will be used, since that leads to producing kernels with different | ||
648 | # security feature characteristics depending on the compiler used. ("But I | ||
649 | # selected CC_STACKPROTECTOR_STRONG! Why did it build with _REGULAR?!") | ||
650 | # | ||
651 | # The middle ground is to warn here so that the failed option is obvious, but | ||
652 | # to let the build fail with bad compiler flags so that we can't produce a | ||
653 | # kernel when there is a CONFIG and compiler mismatch. | ||
654 | # | ||
639 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR | 655 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR |
640 | stackp-flag := -fstack-protector | 656 | stackp-flag := -fstack-protector |
641 | ifeq ($(call cc-option, $(stackp-flag)),) | 657 | ifeq ($(call cc-option, $(stackp-flag)),) |