]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kasan: call kasan_init_generic in kasan_init
authorSabyrzhan Tasbolatov <snovitoll@gmail.com>
Sun, 10 Aug 2025 12:57:46 +0000 (17:57 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:01 +0000 (17:25 -0700)
Call kasan_init_generic() which handles Generic KASAN initialization.  For
architectures that do not select ARCH_DEFER_KASAN, this will be a no-op
for the runtime flag but will print the initialization banner.

For SW_TAGS and HW_TAGS modes, their respective init functions will handle
the flag enabling, if they are enabled/implemented.

Link: https://lkml.kernel.org/r/20250810125746.1105476-3-snovitoll@gmail.com
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217049
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> [riscv]
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> [s390]
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Alexander Potapenko <glider@google.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: David Gow <davidgow@google.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Huacai Chen <chenhuacai@loongson.cn>
Cc: Marco Elver <elver@google.com>
Cc: Qing Zhang <zhangqing@loongson.cn>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm/mm/kasan_init.c
arch/arm64/mm/kasan_init.c
arch/riscv/mm/kasan_init.c
arch/s390/kernel/early.c
arch/x86/mm/kasan_init_64.c
arch/xtensa/mm/kasan_init.c

index 111d4f703136e4b758dc6fe027ffd7780ea3714d..c6625e808bf85e76f54608039c6bdf9ad0864ea5 100644 (file)
@@ -300,6 +300,6 @@ void __init kasan_init(void)
        local_flush_tlb_all();
 
        memset(kasan_early_shadow_page, 0, PAGE_SIZE);
-       pr_info("Kernel address sanitizer initialized\n");
        init_task.kasan_depth = 0;
+       kasan_init_generic();
 }
index d541ce45daeb9ded4c213ffeecc9c5c646eddb3a..abeb81bf6ebd5bb4e7dd7f5711917adaab68e54a 100644 (file)
@@ -399,14 +399,12 @@ void __init kasan_init(void)
 {
        kasan_init_shadow();
        kasan_init_depth();
-#if defined(CONFIG_KASAN_GENERIC)
+       kasan_init_generic();
        /*
         * Generic KASAN is now fully initialized.
         * Software and Hardware Tag-Based modes still require
         * kasan_init_sw_tags() and kasan_init_hw_tags() correspondingly.
         */
-       pr_info("KernelAddressSanitizer initialized (generic)\n");
-#endif
 }
 
 #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
index 41c635d6aca4e9a87078378ee9ca842422c4c6ff..c4a2a9e5586e758f7a97d816a2a63fd575e5e82f 100644 (file)
@@ -533,4 +533,5 @@ void __init kasan_init(void)
 
        csr_write(CSR_SATP, PFN_DOWN(__pa(swapper_pg_dir)) | satp_mode);
        local_flush_tlb_all();
+       kasan_init_generic();
 }
index 9adfbdd377dcf6227690e4047ffac72d06a53c81..544e5403dd917e7162daf307953e7b9584635e64 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <asm/asm-extable.h>
 #include <linux/memblock.h>
+#include <linux/kasan.h>
 #include <asm/access-regs.h>
 #include <asm/asm-offsets.h>
 #include <asm/machine.h>
@@ -65,7 +66,7 @@ static void __init kasan_early_init(void)
 {
 #ifdef CONFIG_KASAN
        init_task.kasan_depth = 0;
-       pr_info("KernelAddressSanitizer initialized\n");
+       kasan_init_generic();
 #endif
 }
 
index 0539efd0d216b99db014469e14602178154d9a9a..998b6010d6d3476f428e6cbe9611addc7938e79b 100644 (file)
@@ -451,5 +451,5 @@ void __init kasan_init(void)
        __flush_tlb_all();
 
        init_task.kasan_depth = 0;
-       pr_info("KernelAddressSanitizer initialized\n");
+       kasan_init_generic();
 }
index f39c4d83173a8aa7e694fce051a5302e08a991dc..0524b9ed5e63938b83fbcc82d4330139c9115839 100644 (file)
@@ -94,5 +94,5 @@ void __init kasan_init(void)
 
        /* At this point kasan is fully initialized. Enable error messages. */
        current->kasan_depth = 0;
-       pr_info("KernelAddressSanitizer initialized\n");
+       kasan_init_generic();
 }