[PATCH v4 11/12] arch/um: don't initialize kasan if it's disabled

Baoquan He posted 12 patches 3 days, 17 hours ago
[PATCH v4 11/12] arch/um: don't initialize kasan if it's disabled
Posted by Baoquan He 3 days, 17 hours ago
And also do the kasan_arg_disabled chekcing before kasan_flag_enabled
enabling to make sure kernel parameter kasan=on|off has been parsed.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: linux-um@lists.infradead.org
---
 arch/um/kernel/mem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 39c4a7e21c6f..08cd012a6bb8 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -62,8 +62,11 @@ static unsigned long brk_end;
 
 void __init arch_mm_preinit(void)
 {
+#ifdef CONFIG_KASAN
 	/* Safe to call after jump_label_init(). Enables KASAN. */
-	kasan_init_generic();
+	if (!kasan_arg_disabled)
+		kasan_init_generic();
+#endif
 
 	/* clear the zero-page */
 	memset(empty_zero_page, 0, PAGE_SIZE);
-- 
2.41.0
Re: [PATCH v4 11/12] arch/um: don't initialize kasan if it's disabled
Posted by Johannes Berg 10 hours ago
On Fri, 2025-11-28 at 11:33 +0800, Baoquan He wrote:
> And also do the kasan_arg_disabled chekcing before kasan_flag_enabled
                                     ^^^^^^^^

typo

> enabling to make sure kernel parameter kasan=on|off has been parsed.

But I'm not sure how to understand that sentence.

And I have no idea what to do with this patch, with it being random CC
of the middle of the series.

johannes