Re: [PATCH] kasan: support vmalloc backing of vm_map_ram()
From: Andrey Ryabinin
Date: Wed Dec 04 2019 - 15:46:43 EST
On 11/29/19 6:45 PM, Daniel Axtens wrote:
> @@ -1826,7 +1842,15 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t pro
>
> addr = va->va_start;
> mem = (void *)addr;
> +
> + if (kasan_populate_vmalloc_area(size, mem)) {
> + vm_unmap_ram(mem, count);
> + return NULL;
> + }
> }
> +
> + kasan_unpoison_shadow(mem, size);
> +
This probably gonna explode on CONFIG_KASAN=y && CONFIG_KASAN_VMALLOC=n
I've sent alternative patch which fixes vm_map_ram() and also makes the code a bit easier to follow in my opinion.
> if (vmap_page_range(addr, addr + size, prot, pages) < 0) {
> vm_unmap_ram(mem, count);
> return NULL;
>