2022-11-02 11:41:49

by Alexander Potapenko

[permalink] [raw]
Subject: [PATCH 4/5] kmsan: make sure PREEMPT_RT is off

As pointed out by Peter Zijlstra, __msan_poison_alloca() does not play
well with IRQ code when PREEMPT_RT is on, because in that mode even
GFP_ATOMIC allocations cannot be performed.

Fixing this would require making stackdepot completely lockless, which
is quite challenging and may be excessive for the time being.

Instead, make sure KMSAN is incompatible with PREEMPT_RT, like other
debug configs are.

Cc: Andrew Morton <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Marco Elver <[email protected]>
Cc: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Alexander Potapenko <[email protected]>
---
lib/Kconfig.kmsan | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/Kconfig.kmsan b/lib/Kconfig.kmsan
index b2489dd6503fa..ef2c8f256c57d 100644
--- a/lib/Kconfig.kmsan
+++ b/lib/Kconfig.kmsan
@@ -12,6 +12,7 @@ config KMSAN
bool "KMSAN: detector of uninitialized values use"
depends on HAVE_ARCH_KMSAN && HAVE_KMSAN_COMPILER
depends on SLUB && DEBUG_KERNEL && !KASAN && !KCSAN
+ depends on !PREEMPT_RT
select STACKDEPOT
select STACKDEPOT_ALWAYS_INIT
help
--
2.38.1.273.g43a17bfeac-goog



2022-11-02 14:01:53

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 4/5] kmsan: make sure PREEMPT_RT is off

On Wed, Nov 02, 2022 at 12:06:10PM +0100, Alexander Potapenko wrote:
> As pointed out by Peter Zijlstra, __msan_poison_alloca() does not play
> well with IRQ code when PREEMPT_RT is on, because in that mode even
> GFP_ATOMIC allocations cannot be performed.
>
> Fixing this would require making stackdepot completely lockless, which
> is quite challenging and may be excessive for the time being.
>
> Instead, make sure KMSAN is incompatible with PREEMPT_RT, like other
> debug configs are.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Dmitry Vyukov <[email protected]>
> Cc: Marco Elver <[email protected]>
> Cc: Peter Zijlstra (Intel) <[email protected]>
> Link: https://lore.kernel.org/lkml/[email protected]/
> Signed-off-by: Alexander Potapenko <[email protected]>

Acked-by: Peter Zijlstra (Intel) <[email protected]>

> ---
> lib/Kconfig.kmsan | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/Kconfig.kmsan b/lib/Kconfig.kmsan
> index b2489dd6503fa..ef2c8f256c57d 100644
> --- a/lib/Kconfig.kmsan
> +++ b/lib/Kconfig.kmsan
> @@ -12,6 +12,7 @@ config KMSAN
> bool "KMSAN: detector of uninitialized values use"
> depends on HAVE_ARCH_KMSAN && HAVE_KMSAN_COMPILER
> depends on SLUB && DEBUG_KERNEL && !KASAN && !KCSAN
> + depends on !PREEMPT_RT
> select STACKDEPOT
> select STACKDEPOT_ALWAYS_INIT
> help
> --
> 2.38.1.273.g43a17bfeac-goog
>