public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Makefile: Another fix for stackprotector _AUTO mode
@ 2017-10-15  3:42 Kees Cook
  2017-10-15  9:05 ` Robert Jarzmik
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2017-10-15  3:42 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: linux-kernel

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.

Reported-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Robert, can you test this fix?
---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index aad7a1ae4791..ba88227fb2bd 100644
--- a/Makefile
+++ b/Makefile
@@ -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
-- 
2.7.4


-- 
Kees Cook
Pixel Security

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Makefile: Another fix for stackprotector _AUTO mode
  2017-10-15  3:42 [PATCH] Makefile: Another fix for stackprotector _AUTO mode Kees Cook
@ 2017-10-15  9:05 ` Robert Jarzmik
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Jarzmik @ 2017-10-15  9:05 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel

Kees Cook <keescook@chromium.org> writes:

> 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.
>
> Reported-by: Robert Jarzmik <robert.jarzmik@free.fr>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> Robert, can you test this fix?
Sure, tested and it works perfectly.

Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-15  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-15  3:42 [PATCH] Makefile: Another fix for stackprotector _AUTO mode Kees Cook
2017-10-15  9:05 ` Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox