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/[email protected] Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Alexander Potapenko <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Marco Elver <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Kees Cook <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent db5e8d8 commit cbadaf7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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)