From: Greg Kroah-Hartman <gre...@linuxfoundation.org>

From: Andrey Konovalov <andreyk...@google.com>

commit d9b571c885a8974fbb7d4ee639dbc643fd000f9e upstream.

There's a runtime failure when running HW_TAGS-enabled kernel built with
GCC on hardware that doesn't support MTE.  GCC-built kernels always have
CONFIG_KASAN_STACK enabled, even though stack instrumentation isn't
supported by HW_TAGS.  Having that config enabled causes KASAN to issue
MTE-only instructions to unpoison kernel stacks, which causes the failure.

Fix the issue by disallowing CONFIG_KASAN_STACK when HW_TAGS is used.

(The commit that introduced CONFIG_KASAN_HW_TAGS specified proper
 dependency for CONFIG_KASAN_STACK_ENABLE but not for CONFIG_KASAN_STACK.)

Link: 
https://lkml.kernel.org/r/59e75426241dbb5611277758c8d4d6f5f9298dac.1615215441.git.andreyk...@google.com
Fixes: 6a63a63ff1ac ("kasan: introduce CONFIG_KASAN_HW_TAGS")
Signed-off-by: Andrey Konovalov <andreyk...@google.com>
Reported-by: Catalin Marinas <catalin.mari...@arm.com>
Cc: <sta...@vger.kernel.org>
Cc: Will Deacon <will.dea...@arm.com>
Cc: Vincenzo Frascino <vincenzo.frasc...@arm.com>
Cc: Dmitry Vyukov <dvyu...@google.com>
Cc: Andrey Ryabinin <aryabi...@virtuozzo.com>
Cc: Alexander Potapenko <gli...@google.com>
Cc: Marco Elver <el...@google.com>
Cc: Peter Collingbourne <p...@google.com>
Cc: Evgenii Stepanov <euge...@google.com>
Cc: Branislav Rankov <branislav.ran...@arm.com>
Cc: Kevin Brodsky <kevin.brod...@arm.com>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 lib/Kconfig.kasan |    1 +
 1 file changed, 1 insertion(+)

--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -156,6 +156,7 @@ config KASAN_STACK_ENABLE
 
 config KASAN_STACK
        int
+       depends on KASAN_GENERIC || KASAN_SW_TAGS
        default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
        default 0
 


Reply via email to