All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] kmsan: core: kmsan_in_runtime() should return true in NMI context
@ 2022-11-02 11:06 Alexander Potapenko
  2022-11-02 11:06 ` [PATCH 2/5] x86/uaccess: instrument copy_from_user_nmi() Alexander Potapenko
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Alexander Potapenko @ 2022-11-02 11:06 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, linux-mm, Andrew Morton, Dmitry Vyukov,
	Marco Elver, Peter Zijlstra

Without that, every call to __msan_poison_alloca() in NMI may end up
allocating memory, which is NMI-unsafe.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/lkml/20221025221755.3810809-1-glider@google.com/
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 mm/kmsan/kmsan.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h
index 961eb658020aa..3cd2050a33e6a 100644
--- a/mm/kmsan/kmsan.h
+++ b/mm/kmsan/kmsan.h
@@ -125,6 +125,8 @@ static __always_inline bool kmsan_in_runtime(void)
 {
 	if ((hardirq_count() >> HARDIRQ_SHIFT) > 1)
 		return true;
+	if (in_nmi())
+		return true;
 	return kmsan_get_context()->kmsan_in_runtime;
 }
 
-- 
2.38.1.273.g43a17bfeac-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-03 13:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 11:06 [PATCH 1/5] kmsan: core: kmsan_in_runtime() should return true in NMI context Alexander Potapenko
2022-11-02 11:06 ` [PATCH 2/5] x86/uaccess: instrument copy_from_user_nmi() Alexander Potapenko
2022-11-02 12:52   ` Peter Zijlstra
2022-11-02 11:06 ` [PATCH 3/5] Kconfig.debug: ensure early check for KMSAN in CONFIG_KMSAN_WARN Alexander Potapenko
2022-11-02 11:06 ` [PATCH 4/5] kmsan: make sure PREEMPT_RT is off Alexander Potapenko
2022-11-02 12:53   ` Peter Zijlstra
2022-11-02 11:06 ` [PATCH 5/5] x86/traps: avoid KMSAN bugs originating from handle_bug() Alexander Potapenko
2022-11-02 12:50   ` Peter Zijlstra
2022-11-02 13:37     ` Alexander Potapenko
2022-11-03 11:18       ` Peter Zijlstra
2022-11-03 11:18   ` Peter Zijlstra
2022-11-03 13:37     ` Alexander Potapenko
2022-11-02 12:52 ` [PATCH 1/5] kmsan: core: kmsan_in_runtime() should return true in NMI context Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.