* [PATCH v3 08/12] arch/riscv: 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, linux-riscv
And also add code to enable kasan_flag_enabled, this is for later
usage.
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: linux-riscv@lists.infradead.org
---
arch/riscv/mm/kasan_init.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
index 41c635d6aca4..ac3ac227c765 100644
--- a/arch/riscv/mm/kasan_init.c
+++ b/arch/riscv/mm/kasan_init.c
@@ -485,6 +485,9 @@ void __init kasan_init(void)
phys_addr_t p_start, p_end;
u64 i;
+ if (kasan_arg_disabled)
+ return;
+
create_tmp_mapping();
csr_write(CSR_SATP, PFN_DOWN(__pa(tmp_pg_dir)) | satp_mode);
@@ -531,6 +534,9 @@ void __init kasan_init(void)
memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE);
init_task.kasan_depth = 0;
+ /* KASAN is now initialized, enable it. */
+ static_branch_enable(&kasan_flag_enabled);
+
csr_write(CSR_SATP, PFN_DOWN(__pa(swapper_pg_dir)) | satp_mode);
local_flush_tlb_all();
}
--
2.41.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-20 5:45 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 08/12] arch/riscv: 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).