Skip to contentSkip to conversation

Makefile: Another fix for stackprotector _AUTO mode

PATCH In review Kees Cook 2 participants 2 messages Oct 15, 2017 Kbuild

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 Makefile: Another fix for stackprotector _AUTO mode

If the compiler didn't support a build mode, the second empty test would still trip. This moves it to an "else" test for the non-AUTO modes.

---
Robert, can you test this fix?

---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -3
index aad7a1ae4791..ba88227fb2bd 100644
@@ -1092,16 +1092,17 @@ PHONY += prepare-compiler-check
 prepare-compiler-check: FORCE
 # Make sure compiler supports requested stack protector flag.
 ifdef stackp-name
-  # Warn about CONFIG_CC_STACKPROTECTOR_AUTO having found no option.
   ifeq ($(stackp-flag),)
+	# Warn about CONFIG_CC_STACKPROTECTOR_AUTO having found no option.
 	@echo CONFIG_CC_STACKPROTECTOR_$(stackp-name): \
 		  Compiler does not support any known stack-protector >&2
-  endif
-  # Fail if specifically requested stack protector is missing.
+  else
   ifeq ($(call cc-option, $(stackp-flag)),)
+	# Fail if specifically requested stack protector is missing.
 	@echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \
 		  $(stackp-flag) not supported by compiler >&2 && exit 1
   endif
+  endif
 endif
 # Make sure compiler does not have buggy stack-protector support.
 ifdef stackp-check
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Kees Cook

If the compiler didn't support a build mode, the second empty test would still trip. This moves it to an "else" test for the non-AUTO modes.

---
Robert, can you test this fix?

Sure, tested and it works perfectly.

And just to be more complete, what happened yesterday was that I wrongly wrote "CROSS_COMPILER=arm-linux-gnueabi-" and not "CROSS_COMPILE=arm-linux-gnueabi-".

Normally when I do that kind of mistake, I get a gcc error that my architecture options (-mabi, ...) are not supported. This time I got the stackprotector thing. The good part is that with your patch I see again the gcc warnings I was used too :)

Cheers.

--
Robert

PS:

rj@belgarion:~/mio_linux/kernel$ arm-linux-gnueabi-gcc -fstack-protector
arm-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.