kasan: double -Wframe-larger-than threshold if KASAN
Subsystems (2)
PATCH 1/1 kasan: double -Wframe-larger-than threshold if KASAN
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.
--- lib/Kconfig.debug | 2 ++ 1 file changed, 2 insertions(+)
lib/Kconfig.debug +2 -0
@@ -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)
Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Quoted 6 lines · Marco Elver
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.
Quoted 7 lines
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.
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
Quoted 20 lines
--- lib/Kconfig.debug | 2 ++ 1 file changed, 2 insertions(+)lib/Kconfig.debug +2
-1@@ -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