And also add code to enable kasan_flag_enabled, this is for later usage. Since kasan_init() is called before main(), enabling kasan_flag_enabled is done in arch_mm_preinit() which is after jump_label_init() invocation. Signed-off-by: Baoquan He --- arch/um/kernel/mem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index 76bec7de81b5..392a23d4ef96 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c @@ -26,6 +26,9 @@ int kasan_um_is_ready; void kasan_init(void) { + + if (kasan_arg_disabled) + return; /* * kasan_map_memory will map all of the required address space and * the host machine will allocate physical memory as necessary. @@ -58,6 +61,9 @@ static unsigned long brk_end; void __init arch_mm_preinit(void) { + /* Safe to call after jump_label_init(). Enables KASAN. */ + static_branch_enable(&kasan_flag_enabled); + /* clear the zero-page */ memset(empty_zero_page, 0, PAGE_SIZE); -- 2.41.0