Move kasan_populate_early_vm_area_shadow() from mm/kasan/init.c to mm/kasan/shadow.c, make it under CONFIG_KASAN_VMALLOC to fix the redefinition issue. Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx> Cc: Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: kasan-dev@xxxxxxxxxxxxxxxx Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> --- Hi Andrew, Could you help to merge this into previos patch "kasan: arm64: fix pcpu_page_first_chunk crash with KASAN_VMALLOC", sorry for the build error. mm/kasan/init.c | 5 ----- mm/kasan/shadow.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/kasan/init.c b/mm/kasan/init.c index d39577d088a1..cc64ed6858c6 100644 --- a/mm/kasan/init.c +++ b/mm/kasan/init.c @@ -279,11 +279,6 @@ int __ref kasan_populate_early_shadow(const void *shadow_start, return 0; } -void __init __weak kasan_populate_early_vm_area_shadow(void *start, - unsigned long size) -{ -} - static void kasan_free_pte(pte_t *pte_start, pmd_t *pmd) { pte_t *pte; diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c index 8d95ee52d019..4a4929b29a23 100644 --- a/mm/kasan/shadow.c +++ b/mm/kasan/shadow.c @@ -254,6 +254,11 @@ core_initcall(kasan_memhotplug_init); #ifdef CONFIG_KASAN_VMALLOC +void __init __weak kasan_populate_early_vm_area_shadow(void *start, + unsigned long size) +{ +} + static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr, void *unused) { -- 2.27.0