Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kasan: call kasan_init_generic in kasan_init

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>

authored by

Sabyrzhan Tasbolatov and committed by
Andrew Morton
e45085f2 1e338f4d

+7 -7
+1 -1
arch/arm/mm/kasan_init.c
··· 300 300 local_flush_tlb_all(); 301 301 302 302 memset(kasan_early_shadow_page, 0, PAGE_SIZE); 303 - pr_info("Kernel address sanitizer initialized\n"); 304 303 init_task.kasan_depth = 0; 304 + kasan_init_generic(); 305 305 }
+1 -3
arch/arm64/mm/kasan_init.c
··· 399 399 { 400 400 kasan_init_shadow(); 401 401 kasan_init_depth(); 402 - #if defined(CONFIG_KASAN_GENERIC) 402 + kasan_init_generic(); 403 403 /* 404 404 * Generic KASAN is now fully initialized. 405 405 * Software and Hardware Tag-Based modes still require 406 406 * kasan_init_sw_tags() and kasan_init_hw_tags() correspondingly. 407 407 */ 408 - pr_info("KernelAddressSanitizer initialized (generic)\n"); 409 - #endif 410 408 } 411 409 412 410 #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */
+1
arch/riscv/mm/kasan_init.c
··· 533 533 534 534 csr_write(CSR_SATP, PFN_DOWN(__pa(swapper_pg_dir)) | satp_mode); 535 535 local_flush_tlb_all(); 536 + kasan_init_generic(); 536 537 }
+2 -1
arch/s390/kernel/early.c
··· 21 21 #include <linux/kernel.h> 22 22 #include <asm/asm-extable.h> 23 23 #include <linux/memblock.h> 24 + #include <linux/kasan.h> 24 25 #include <asm/access-regs.h> 25 26 #include <asm/asm-offsets.h> 26 27 #include <asm/machine.h> ··· 66 65 { 67 66 #ifdef CONFIG_KASAN 68 67 init_task.kasan_depth = 0; 69 - pr_info("KernelAddressSanitizer initialized\n"); 68 + kasan_init_generic(); 70 69 #endif 71 70 } 72 71
+1 -1
arch/x86/mm/kasan_init_64.c
··· 451 451 __flush_tlb_all(); 452 452 453 453 init_task.kasan_depth = 0; 454 - pr_info("KernelAddressSanitizer initialized\n"); 454 + kasan_init_generic(); 455 455 }
+1 -1
arch/xtensa/mm/kasan_init.c
··· 94 94 95 95 /* At this point kasan is fully initialized. Enable error messages. */ 96 96 current->kasan_depth = 0; 97 - pr_info("KernelAddressSanitizer initialized\n"); 97 + kasan_init_generic(); 98 98 }