Re: [PATCH v3 1/3] vmalloc: add __GFP_SKIP_KASAN support
From: Dev Jain
Date: Sun Apr 26 2026 - 23:42:23 EST
On 25/04/26 2:44 pm, Catalin Marinas wrote:
> On Fri, Apr 24, 2026 at 06:31:55PM +0530, Dev Jain wrote:
>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>> index b31b208f6ecb3..c94fcb2725b6b 100644
>> --- a/mm/vmalloc.c
>> +++ b/mm/vmalloc.c
>> @@ -3939,7 +3939,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>> __GFP_NOFAIL | __GFP_ZERO |\
>> __GFP_NORETRY | __GFP_RETRY_MAYFAIL |\
>> GFP_NOFS | GFP_NOIO | GFP_KERNEL_ACCOUNT |\
>> - GFP_USER | __GFP_NOLOCKDEP)
>> + GFP_USER | __GFP_NOLOCKDEP | __GFP_SKIP_KASAN)
>>
>> static gfp_t vmalloc_fix_flags(gfp_t flags)
>> {
>> @@ -3980,6 +3980,9 @@ static gfp_t vmalloc_fix_flags(gfp_t flags)
>> *
>> * %__GFP_NOWARN can be used to suppress failure messages.
>> *
>> + * %__GFP_SKIP_KASAN can be used to skip unpoisoning of mapped pages
>> + * (when prot=%PAGE_KERNEL).
>
> I just realised, if we go with this flag for vmalloc(), there's also a
> comment in gfp_types.h implying that pages are unpoisoned by
> kasan_unpoison_vmalloc() instead. This is no longer the case with this
> patch.
>
> A VM_SKIP_KASAN flag may have been nicer but we already have
> THREADINFO_GFP and GFP_VMAP_STACK, so all those call sites would have to
> be moved to call the lower-level __vmalloc_node_range().
Yep we were discussing this only on v2, and realized the wider cleanup
is not trivial and should be made separately.
But I should change the documentation of GFP_SKIP_KASAN to say that
if it passed on to vmalloc then it will also skip unpoisoning.
>