diff options
author | Kees Cook <keescook@chromium.org> | 2018-02-06 18:37:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-06 21:32:44 -0500 |
commit | 2b8383927525d6281cbad1cc70a83d2319eeae47 (patch) | |
tree | 58b14630915e20fe2f5794d9fe67837027a58436 /Makefile | |
parent | 4bf8ba811ac1102d7de6f73af3b9f323463e16c0 (diff) |
Makefile: move stack-protector compiler breakage test earlier
In order to make stack-protector failures warn instead of unconditionally
breaking the build, this moves the compiler output sanity-check earlier,
and sets a flag for later testing. Future patches can choose to warn or
fail, depending on the flag value.
Link: http://lkml.kernel.org/r/1510076320-69931-2-git-send-email-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Laura Abbott <labbott@redhat.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Josh Triplett <josh@joshtriplett.org>
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 | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -696,6 +696,12 @@ endif | |||
696 | ifdef CONFIG_CC_STACKPROTECTOR | 696 | ifdef CONFIG_CC_STACKPROTECTOR |
697 | stackp-path := $(srctree)/scripts/gcc-$(SRCARCH)_$(BITS)-has-stack-protector.sh | 697 | stackp-path := $(srctree)/scripts/gcc-$(SRCARCH)_$(BITS)-has-stack-protector.sh |
698 | stackp-check := $(wildcard $(stackp-path)) | 698 | stackp-check := $(wildcard $(stackp-path)) |
699 | # If the wildcard test matches a test script, run it to check functionality. | ||
700 | ifdef stackp-check | ||
701 | ifneq ($(shell $(CONFIG_SHELL) $(stackp-check) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y) | ||
702 | stackp-broken := y | ||
703 | endif | ||
704 | endif | ||
699 | endif | 705 | endif |
700 | KBUILD_CFLAGS += $(stackp-flag) | 706 | KBUILD_CFLAGS += $(stackp-flag) |
701 | 707 | ||
@@ -1098,11 +1104,9 @@ ifdef stackp-name | |||
1098 | endif | 1104 | endif |
1099 | endif | 1105 | endif |
1100 | # Make sure compiler does not have buggy stack-protector support. | 1106 | # Make sure compiler does not have buggy stack-protector support. |
1101 | ifdef stackp-check | 1107 | ifdef stackp-broken |
1102 | ifneq ($(shell $(CONFIG_SHELL) $(stackp-check) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y) | ||
1103 | @echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \ | 1108 | @echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \ |
1104 | $(stackp-flag) available but compiler is broken >&2 && exit 1 | 1109 | $(stackp-flag) available but compiler is broken >&2 && exit 1 |
1105 | endif | ||
1106 | endif | 1110 | endif |
1107 | @: | 1111 | @: |
1108 | 1112 | ||