path: root/mm/vmalloc.c
diff options
authorKefeng Wang <>2021-11-05 13:39:47 -0700
committerLinus Torvalds <>2021-11-06 13:30:37 -0700
commit3252b1d8309ea42bc6329d9341072ecf1c9505c0 (patch)
treee55752081a97cca77027c9191612c24029ebde1c /mm/vmalloc.c
parent09cea6195073ee1d0f076d907d9249045757245d (diff)
kasan: arm64: fix pcpu_page_first_chunk crash with KASAN_VMALLOC
With KASAN_VMALLOC and NEED_PER_CPU_PAGE_FIRST_CHUNK the kernel crashes: Unable to handle kernel paging request at virtual address ffff7000028f2000 ... swapper pgtable: 64k pages, 48-bit VAs, pgdp=0000000042440000 [ffff7000028f2000] pgd=000000063e7c0003, p4d=000000063e7c0003, pud=000000063e7c0003, pmd=000000063e7b0003, pte=0000000000000000 Internal error: Oops: 96000007 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.13.0-rc4-00003-gc6e6e28f3f30-dirty #62 Hardware name: linux,dummy-virt (DT) pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO BTYPE=--) pc : kasan_check_range+0x90/0x1a0 lr : memcpy+0x88/0xf4 sp : ffff80001378fe20 ... Call trace: kasan_check_range+0x90/0x1a0 pcpu_page_first_chunk+0x3f0/0x568 setup_per_cpu_areas+0xb8/0x184 start_kernel+0x8c/0x328 The vm area used in vm_area_register_early() has no kasan shadow memory, Let's add a new kasan_populate_early_vm_area_shadow() function to populate the vm area shadow memory to fix the issue. [ fix redefinition of 'kasan_populate_early_vm_area_shadow'] Link: Link: Signed-off-by: Kefeng Wang <> Acked-by: Marco Elver <> [KASAN] Acked-by: Andrey Konovalov <> [KASAN] Acked-by: Catalin Marinas <> Cc: Andrey Ryabinin <> Cc: Dmitry Vyukov <> Cc: Greg Kroah-Hartman <> Cc: Will Deacon <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/vmalloc.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 74da45a8beec..75fa100f5424 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2291,6 +2291,7 @@ void __init vm_area_register_early(struct vm_struct *vm, size_t align)
vm->addr = (void *)addr;
vm->next = *p;
*p = vm;
+ kasan_populate_early_vm_area_shadow(vm->addr, vm->size);
static void vmap_init_free_space(void)