The patch titled Subject: update to "kasan: support backing vmalloc space with real shadow memory" has been added to the -mm tree. Its filename is kasan-support-backing-vmalloc-space-with-real-shadow-memory-update.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-support-backing-vmalloc-space-with-real-shadow-memory-update.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-support-backing-vmalloc-space-with-real-shadow-memory-update.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Daniel Axtens <dja@xxxxxxxxxx> Subject: update to "kasan: support backing vmalloc space with real shadow memory" There are 2 changes: - A fixup to the per-cpu allocator path to avoid allocating memory under a spinlock, thanks Qian Cai. - Insert flush_cache_vmap() between mapping shadow and poisoning it. This is a no-op on x86 and arm64, but on powerpc it does a ptesync instruction which prevents occasional page faults. Link: http://lkml.kernel.org/r/20191120052719.7201-1-dja@xxxxxxxxxx Signed-off-by: Daniel Axtens <dja@xxxxxxxxxx> Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx> [shadow rework] Co-developed-by: Mark Rutland <mark.rutland@xxxxxxx> Acked-by: Vasily Gorbik <gor@xxxxxxxxxxxxx> Reviewed-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxx> Cc: Qian Cai <cai@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kasan/common.c | 2 ++ mm/vmalloc.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) --- a/mm/kasan/common.c~kasan-support-backing-vmalloc-space-with-real-shadow-memory-update +++ a/mm/kasan/common.c @@ -794,6 +794,8 @@ int kasan_populate_vmalloc(unsigned long if (ret) return ret; + flush_cache_vmap(shadow_start, shadow_end); + kasan_unpoison_shadow(area->addr, requested_size); area->flags |= VM_KASAN; --- a/mm/vmalloc.c~kasan-support-backing-vmalloc-space-with-real-shadow-memory-update +++ a/mm/vmalloc.c @@ -3414,11 +3414,14 @@ retry: setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC, pcpu_get_vm_areas); + } + spin_unlock(&vmap_area_lock); + /* populate the shadow space outside of the lock */ + for (area = 0; area < nr_vms; area++) { /* assume success here */ kasan_populate_vmalloc(sizes[area], vms[area]); } - spin_unlock(&vmap_area_lock); kfree(vas); return vms; _ Patches currently in -mm which might be from dja@xxxxxxxxxx are kasan-support-backing-vmalloc-space-with-real-shadow-memory.patch kasan-support-backing-vmalloc-space-with-real-shadow-memory-update.patch kasan-add-test-for-vmalloc.patch fork-support-vmap_stack-with-kasan_vmalloc.patch x86-kasan-support-kasan_vmalloc.patch