[PATCH v5 11/15] arch/x86: don't initialize kasan if it's disabled
Baoquan He
bhe at redhat.com
Wed Feb 25 00:14:08 PST 2026
Here, kasan is disabled if specified 'kasan=off' in kernel cmdline.
Signed-off-by: Baoquan He <bhe at redhat.com>
Cc: x86 at kernel.org
---
arch/x86/mm/kasan_init_64.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index 998b6010d6d3..5ebf2850c77d 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -343,6 +343,10 @@ void __init kasan_init(void)
unsigned long shadow_cea_begin, shadow_cea_per_cpu_begin, shadow_cea_end;
int i;
+ /* If KASAN is disabled via command line, don't initialize it. */
+ if (kasan_arg_disabled)
+ return;
+
memcpy(early_top_pgt, init_top_pgt, sizeof(early_top_pgt));
/*
--
2.52.0
More information about the linux-arm-kernel
mailing list