Skip to content

Commit cbadaf7

Browse files
ramosian-gliderakpm00
authored andcommitted
kmsan: core: kmsan_in_runtime() should return true in NMI context
Without that, every call to __msan_poison_alloca() in NMI may end up allocating memory, which is NMI-unsafe. Link: https://lkml.kernel.org/r/20221102110611.1085175-1-glider@google.com Link: https://lore.kernel.org/lkml/20221025221755.3810809-1-glider@google.com/ Signed-off-by: Alexander Potapenko <glider@google.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Marco Elver <elver@google.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent db5e8d8 commit cbadaf7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

mm/kmsan/kmsan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ static __always_inline bool kmsan_in_runtime(void)
124124
{
125125
if ((hardirq_count() >> HARDIRQ_SHIFT) > 1)
126126
return true;
127+
if (in_nmi())
128+
return true;
127129
return kmsan_get_context()->kmsan_in_runtime;
128130
}
129131

0 commit comments

Comments
 (0)