All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kasan: double -Wframe-larger-than threshold if KASAN
@ 2021-09-09 10:49 ` Marco Elver
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Elver @ 2021-09-09 10:49 UTC (permalink / raw)
  To: elver, Andrew Morton
  Cc: linux-kernel, kasan-dev, Arnd Bergmann, Christoph Hellwig,
	Guenter Roeck, Nathan Chancellor, Nick Desaulniers,
	Aleksandr Nogikh, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Taras Madan, linux-mm, llvm

All architectures at least double stack size when using one of the KASAN
software modes that rely on compiler instrumentation.

Until now, warnings emitted by -Wframe-larger-than could easily be
ignored, as we would still get a working kernel.

However, with the introduction of -Werror (CONFIG_WERROR=y), it makes
sense to at least double the -Wframe-larger-than threshold for
software-based KASAN modes to reflect the already increased stack sizes
when building a kernel with KASAN enabled.

Link: https://lkml.kernel.org/r/YTbOs13waorzamZ6@Ryzen-9-3900X.localdomain
Signed-off-by: Marco Elver <elver@google.com>
---
 lib/Kconfig.debug | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index ed4a31e34098..2055bbb6724a 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -345,6 +345,8 @@ endif # DEBUG_INFO
 config FRAME_WARN
 	int "Warn for stack frames larger than"
 	range 0 8192
+	default 4096 if 64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
+	default 2048 if !64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
 	default 2048 if GCC_PLUGIN_LATENT_ENTROPY
 	default 1536 if (!64BIT && PARISC)
 	default 1024 if (!64BIT && !PARISC)
-- 
2.33.0.153.gba50c8fa24-goog


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

* [PATCH] kasan: double -Wframe-larger-than threshold if KASAN
@ 2021-09-09 10:49 ` Marco Elver
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Elver @ 2021-09-09 10:49 UTC (permalink / raw)
  To: elver, Andrew Morton
  Cc: linux-kernel, kasan-dev, Arnd Bergmann, Christoph Hellwig,
	Guenter Roeck, Nathan Chancellor, Nick Desaulniers,
	Aleksandr Nogikh, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Taras Madan, linux-mm, llvm

All architectures at least double stack size when using one of the KASAN
software modes that rely on compiler instrumentation.

Until now, warnings emitted by -Wframe-larger-than could easily be
ignored, as we would still get a working kernel.

However, with the introduction of -Werror (CONFIG_WERROR=y), it makes
sense to at least double the -Wframe-larger-than threshold for
software-based KASAN modes to reflect the already increased stack sizes
when building a kernel with KASAN enabled.

Link: https://lkml.kernel.org/r/YTbOs13waorzamZ6@Ryzen-9-3900X.localdomain
Signed-off-by: Marco Elver <elver@google.com>
---
 lib/Kconfig.debug | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index ed4a31e34098..2055bbb6724a 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -345,6 +345,8 @@ endif # DEBUG_INFO
 config FRAME_WARN
 	int "Warn for stack frames larger than"
 	range 0 8192
+	default 4096 if 64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
+	default 2048 if !64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
 	default 2048 if GCC_PLUGIN_LATENT_ENTROPY
 	default 1536 if (!64BIT && PARISC)
 	default 1024 if (!64BIT && !PARISC)
-- 
2.33.0.153.gba50c8fa24-goog


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

* Re: [PATCH] kasan: double -Wframe-larger-than threshold if KASAN
  2021-09-09 10:49 ` Marco Elver
@ 2021-09-09 11:46   ` Marco Elver
  -1 siblings, 0 replies; 4+ messages in thread
From: Marco Elver @ 2021-09-09 11:46 UTC (permalink / raw)
  To: elver, Andrew Morton
  Cc: linux-kernel, kasan-dev, Arnd Bergmann, Christoph Hellwig,
	Guenter Roeck, Nathan Chancellor, Nick Desaulniers,
	Aleksandr Nogikh, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Taras Madan, linux-mm, llvm

On Thu, 9 Sept 2021 at 12:49, Marco Elver <elver@google.com> wrote:
> All architectures at least double stack size when using one of the KASAN
> software modes that rely on compiler instrumentation.
>
> Until now, warnings emitted by -Wframe-larger-than could easily be
> ignored, as we would still get a working kernel.
>
> However, with the introduction of -Werror (CONFIG_WERROR=y), it makes
> sense to at least double the -Wframe-larger-than threshold for
> software-based KASAN modes to reflect the already increased stack sizes
> when building a kernel with KASAN enabled.
>
> Link: https://lkml.kernel.org/r/YTbOs13waorzamZ6@Ryzen-9-3900X.localdomain
> Signed-off-by: Marco Elver <elver@google.com>

FWIW, there's still no consensus if this is what we want, and the
discussion continues at:
https://lkml.kernel.org/r/CANpmjNPBdx4b7bp=reNJPMzSNetdyrk+503_1LLoxNMYwUhSHg@mail.gmail.com

> ---
>  lib/Kconfig.debug | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index ed4a31e34098..2055bbb6724a 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -345,6 +345,8 @@ endif # DEBUG_INFO
>  config FRAME_WARN
>         int "Warn for stack frames larger than"
>         range 0 8192
> +       default 4096 if 64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
> +       default 2048 if !64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
>         default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>         default 1536 if (!64BIT && PARISC)
>         default 1024 if (!64BIT && !PARISC)
> --
> 2.33.0.153.gba50c8fa24-goog
>

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

* Re: [PATCH] kasan: double -Wframe-larger-than threshold if KASAN
@ 2021-09-09 11:46   ` Marco Elver
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Elver @ 2021-09-09 11:46 UTC (permalink / raw)
  To: elver, Andrew Morton
  Cc: linux-kernel, kasan-dev, Arnd Bergmann, Christoph Hellwig,
	Guenter Roeck, Nathan Chancellor, Nick Desaulniers,
	Aleksandr Nogikh, Alexander Potapenko, Andrey Konovalov,
	Dmitry Vyukov, Taras Madan, linux-mm, llvm

On Thu, 9 Sept 2021 at 12:49, Marco Elver <elver@google.com> wrote:
> All architectures at least double stack size when using one of the KASAN
> software modes that rely on compiler instrumentation.
>
> Until now, warnings emitted by -Wframe-larger-than could easily be
> ignored, as we would still get a working kernel.
>
> However, with the introduction of -Werror (CONFIG_WERROR=y), it makes
> sense to at least double the -Wframe-larger-than threshold for
> software-based KASAN modes to reflect the already increased stack sizes
> when building a kernel with KASAN enabled.
>
> Link: https://lkml.kernel.org/r/YTbOs13waorzamZ6@Ryzen-9-3900X.localdomain
> Signed-off-by: Marco Elver <elver@google.com>

FWIW, there's still no consensus if this is what we want, and the
discussion continues at:
https://lkml.kernel.org/r/CANpmjNPBdx4b7bp=reNJPMzSNetdyrk+503_1LLoxNMYwUhSHg@mail.gmail.com

> ---
>  lib/Kconfig.debug | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index ed4a31e34098..2055bbb6724a 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -345,6 +345,8 @@ endif # DEBUG_INFO
>  config FRAME_WARN
>         int "Warn for stack frames larger than"
>         range 0 8192
> +       default 4096 if 64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
> +       default 2048 if !64BIT && (KASAN_GENERIC || KASAN_SW_TAGS)
>         default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>         default 1536 if (!64BIT && PARISC)
>         default 1024 if (!64BIT && !PARISC)
> --
> 2.33.0.153.gba50c8fa24-goog
>

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

end of thread, other threads:[~2021-09-09 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 10:49 [PATCH] kasan: double -Wframe-larger-than threshold if KASAN Marco Elver
2021-09-09 10:49 ` Marco Elver
2021-09-09 11:46 ` Marco Elver
2021-09-09 11:46   ` Marco Elver

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.