Re: [PATCH 1/4] vmalloc: add vm_flags argument to internal __vmalloc_node()

From: Andrey Ryabinin
Date: Wed Feb 21 2018 - 07:39:05 EST




On 02/21/2018 03:24 PM, Matthew Wilcox wrote:
> On Tue, Jan 23, 2018 at 01:55:22PM +0300, Konstantin Khlebnikov wrote:
>> This allows to set VM_USERMAP in vmalloc_user() and vmalloc_32_user()
>> directly at allocation and avoid find_vm_area() call.
>
> While reviewing this patch, I came across this infelicity ...
>
> have I understood correctly?
>
> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
> index e13d911251e7..9060f80b4a41 100644
> --- a/mm/kasan/kasan.c
> +++ b/mm/kasan/kasan.c
> @@ -631,11 +631,10 @@ int kasan_module_alloc(void *addr, size_t size)
> ret = __vmalloc_node_range(shadow_size, 1, shadow_start,
> shadow_start + shadow_size,
> GFP_KERNEL | __GFP_ZERO,
> - PAGE_KERNEL, VM_NO_GUARD, NUMA_NO_NODE,
> + PAGE_KERNEL, VM_NO_GUARD | VM_KASAN, NUMA_NO_NODE,
> __builtin_return_address(0));
>
> if (ret) {
> - find_vm_area(addr)->flags |= VM_KASAN;

addr != ret
That's different vm areas.

> kmemleak_ignore(ret);
> return 0;
> }
>