Kconfig.debug: ensure early check for KMSAN in CONFIG_KMSAN_WARN
authorAlexander Potapenko <glider@google.com>
Wed, 2 Nov 2022 11:06:09 +0000 (12:06 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 8 Nov 2022 23:57:24 +0000 (15:57 -0800)
As pointed out by Masahiro Yamada, Kconfig picks up the first default
entry which has true 'if' condition.  Hence, the previously added check
for KMSAN was never used, because it followed the checks for 64BIT and
!64BIT.

Put KMSAN check before others to ensure it is always applied.

Link: https://lkml.kernel.org/r/20221102110611.1085175-3-glider@google.com
Link: https://github.com/google/kmsan/issues/89
Link: https://lore.kernel.org/linux-mm/20221024212144.2852069-3-glider@google.com/
Fixes: 921757bc9b61 ("Kconfig.debug: disable CONFIG_FRAME_WARN for KMSAN by default")
Signed-off-by: Alexander Potapenko <glider@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Marco Elver <elver@google.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/Kconfig.debug

index be69844e40e64de557bb21791ebd6febb168683b..c3c0b077ade33c4b7240a4b5247cfc02e5c71182 100644 (file)
@@ -395,12 +395,12 @@ endif # DEBUG_INFO
 config FRAME_WARN
        int "Warn for stack frames larger than"
        range 0 8192
+       default 0 if KMSAN
        default 2048 if GCC_PLUGIN_LATENT_ENTROPY
        default 2048 if PARISC
        default 1536 if (!64BIT && XTENSA)
        default 1024 if !64BIT
        default 2048 if 64BIT
-       default 0 if KMSAN
        help
          Tell the compiler to warn at build time for stack frames larger than this.
          Setting this too low will cause a lot of warnings.