[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250812130933.71593-4-bhe@redhat.com>
Date: Tue, 12 Aug 2025 21:09:32 +0800
From: Baoquan He <bhe@...hat.com>
To: linux-mm@...ck.org
Cc: snovitoll@...il.com,
ryabinin.a.a@...il.com,
christophe.leroy@...roup.eu,
hca@...ux.ibm.com,
andreyknvl@...il.com,
akpm@...ux-foundation.org,
chenhuacai@...ngson.cn,
davidgow@...gle.com,
glider@...gle.com,
dvyukov@...gle.com,
alexghiti@...osinc.com,
kasan-dev@...glegroups.com,
loongarch@...ts.linux.dev,
linuxppc-dev@...ts.ozlabs.org,
linux-um@...ts.infradead.org,
linux-kernel@...r.kernel.org,
agordeev@...ux.ibm.com,
Baoquan He <bhe@...hat.com>
Subject: [PATCH 3/4] arch/um: remove kasan_arch_is_ready()
From: Sabyrzhan Tasbolatov <snovitoll@...il.com>
With the help of static key kasan_flag_enabled, kasan_arch_is_ready()
is not needed any more. So reomve the unneeded kasan_arch_is_ready() and
the relevant codes.
And also error out if both CONFIG_STATIC_LINK and CONFIG_KASAN_INLINE
are set at the same time as UML supports each of them but done's support
both at the same time.
And also add code comment to explain why static key kasan_flag_enabled
need be deferred to arch_mm_preinit().
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@...il.com>
Signed-off-by: Baoquan He <bhe@...hat.com>
---
arch/um/include/asm/kasan.h | 5 ++---
arch/um/kernel/mem.c | 6 +++++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/um/include/asm/kasan.h b/arch/um/include/asm/kasan.h
index f97bb1f7b851..b54a4e937fd1 100644
--- a/arch/um/include/asm/kasan.h
+++ b/arch/um/include/asm/kasan.h
@@ -24,10 +24,9 @@
#ifdef CONFIG_KASAN
void kasan_init(void);
-extern int kasan_um_is_ready;
-#ifdef CONFIG_STATIC_LINK
-#define kasan_arch_is_ready() (kasan_um_is_ready)
+#if defined(CONFIG_STATIC_LINK) && defined(CONFIG_KASAN_INLINE)
+#error UML does not work in KASAN_INLINE mode with STATIC_LINK enabled!
#endif
#else
static inline void kasan_init(void) { }
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 392a23d4ef96..d62f494e0808 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -35,7 +35,11 @@ void kasan_init(void)
*/
kasan_map_memory((void *)KASAN_SHADOW_START, KASAN_SHADOW_SIZE);
init_task.kasan_depth = 0;
- kasan_um_is_ready = true;
+ /*
+ * Since kasan_init() is called before main(),
+ * KASAN is initialized but the enablement is deferred after
+ * jump_label_init(). See arch_mm_preinit().
+ */
}
static void (*kasan_init_ptr)(void)
--
2.41.0
Powered by blists - more mailing lists