* [PATCH v3 06/12] arch/loongarch: don't initialize kasan if it's disabled
[not found] <20250820053459.164825-1-bhe@redhat.com>
@ 2025-08-20 5:34 ` Baoquan He
0 siblings, 0 replies; only message in thread
From: Baoquan He @ 2025-08-20 5:34 UTC (permalink / raw)
To: linux-mm
Cc: ryabinin.a.a, andreyknvl, glider, dvyukov, vincenzo.frascino,
akpm, kasan-dev, linux-kernel, kexec, sj, lorenzo.stoakes, elver,
snovitoll, christophe.leroy, Baoquan He, loongarch
And also add code to enable kasan_flag_enabled, this is for later
usage.
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: loongarch@lists.linux.dev
---
arch/loongarch/mm/kasan_init.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/loongarch/mm/kasan_init.c b/arch/loongarch/mm/kasan_init.c
index d2681272d8f0..0c32eee6910f 100644
--- a/arch/loongarch/mm/kasan_init.c
+++ b/arch/loongarch/mm/kasan_init.c
@@ -267,6 +267,8 @@ void __init kasan_init(void)
u64 i;
phys_addr_t pa_start, pa_end;
+ if (kasan_arg_disabled)
+ return;
/*
* If PGDIR_SIZE is too large for cpu_vabits, KASAN_SHADOW_END will
* overflow UINTPTR_MAX and then looks like a user space address.
@@ -327,6 +329,9 @@ void __init kasan_init(void)
csr_write64(__pa_symbol(swapper_pg_dir), LOONGARCH_CSR_PGDH);
local_flush_tlb_all();
+ /* KASAN is now initialized, enable it. */
+ static_branch_enable(&kasan_flag_enabled);
+
/* At this point kasan is fully initialized. Enable error messages */
init_task.kasan_depth = 0;
pr_info("KernelAddressSanitizer initialized.\n");
--
2.41.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-20 5:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250820053459.164825-1-bhe@redhat.com>
2025-08-20 5:34 ` [PATCH v3 06/12] arch/loongarch: don't initialize kasan if it's disabled Baoquan He
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).