Skip to contentSkip to conversation

kcov: Unconditionally add -fno-stack-protector to compiler options

PATCH Applied Marco Elver 2 participants 2 messages Jun 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kcov: Unconditionally add -fno-stack-protector to compiler options

Unconditionally add -fno-stack-protector to KCOV's compiler options, as all supported compilers support the option. This saves a compiler invocation to determine if the option is supported.

Because Clang does not support -fno-conserve-stack, and -fno-stack-protector was wrapped in the same cc-option, we were missing -fno-stack-protector with Clang. Unconditionally adding this option fixes this for Clang.

---
Split out from series:

	https://lkml.kernel.org/r/[email protected]
as there is no dependency on the preceding patch (which will be dropped).
---
 kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/Makefile +1 -1
index f3218bc5ec69..592cb549dcb8 100644
@@ -35,7 +35,7 @@ KCOV_INSTRUMENT_stacktrace.o := n
 KCOV_INSTRUMENT_kcov.o := n
 KASAN_SANITIZE_kcov.o := n
 KCSAN_SANITIZE_kcov.o := n
-CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
+CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector
 
 # cond_syscall is currently not LTO compatible
 CFLAGS_sys_ni.o = $(DISABLE_LTO)
Signature · 1 line
2.27.0.290.gba653c62da-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 35 lines · Marco Elver

Unconditionally add -fno-stack-protector to KCOV's compiler options, as all supported compilers support the option. This saves a compiler invocation to determine if the option is supported.

Because Clang does not support -fno-conserve-stack, and

(quoted diff) +0 -2
-fno-stack-protector was wrapped in the same cc-option, we were missing
-fno-stack-protector with Clang. Unconditionally adding this option

fixes this for Clang.

---
Split out from series:

        https://lkml.kernel.org/r/[email protected]
as there is no dependency on the preceding patch (which will be dropped).
---
 kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/Makefile +1 -2
index f3218bc5ec69..592cb549dcb8 100644
@@ -35,7 +35,7 @@ KCOV_INSTRUMENT_stacktrace.o := n
 KCOV_INSTRUMENT_kcov.o := n
 KASAN_SANITIZE_kcov.o := n
 KCSAN_SANITIZE_kcov.o := n
-CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
+CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector
 
 # cond_syscall is currently not LTO compatible
 CFLAGS_sys_ni.o = $(DISABLE_LTO)
--
Quoted 2 lines

2.27.0.290.gba653c62da-goog