linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kcov: Unconditionally add -fno-stack-protector to compiler options
@ 2020-06-15 18:43 Marco Elver
  2020-06-15 19:04 ` Andrey Konovalov
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Elver @ 2020-06-15 18:43 UTC (permalink / raw)
  To: elver, akpm
  Cc: dvyukov, glider, andreyknvl, linux-kernel, kasan-dev, Nick Desaulniers

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.

Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Marco Elver <elver@google.com>
---
Split out from series:
	https://lkml.kernel.org/r/20200605082839.226418-2-elver@google.com
as there is no dependency on the preceding patch (which will be dropped).
---
 kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/Makefile b/kernel/Makefile
index f3218bc5ec69..592cb549dcb8 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -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)
-- 
2.27.0.290.gba653c62da-goog


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

* Re: [PATCH] kcov: Unconditionally add -fno-stack-protector to compiler options
  2020-06-15 18:43 [PATCH] kcov: Unconditionally add -fno-stack-protector to compiler options Marco Elver
@ 2020-06-15 19:04 ` Andrey Konovalov
  0 siblings, 0 replies; 2+ messages in thread
From: Andrey Konovalov @ 2020-06-15 19:04 UTC (permalink / raw)
  To: Marco Elver
  Cc: Andrew Morton, Dmitry Vyukov, Alexander Potapenko, LKML,
	kasan-dev, Nick Desaulniers

On Mon, Jun 15, 2020 at 8:43 PM Marco Elver <elver@google.com> wrote:
>
> 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.
>
> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Marco Elver <elver@google.com>
> ---
> Split out from series:
>         https://lkml.kernel.org/r/20200605082839.226418-2-elver@google.com
> as there is no dependency on the preceding patch (which will be dropped).
> ---
>  kernel/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/Makefile b/kernel/Makefile
> index f3218bc5ec69..592cb549dcb8 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile
> @@ -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)
> --
> 2.27.0.290.gba653c62da-goog
>

Reviewed-by: Andrey Konovalov <andreyknvl@google.com>

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

end of thread, other threads:[~2020-06-15 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 18:43 [PATCH] kcov: Unconditionally add -fno-stack-protector to compiler options Marco Elver
2020-06-15 19:04 ` Andrey Konovalov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).