Re: [PATCH v3 1/3] vmalloc: add __GFP_SKIP_KASAN support
From: Catalin Marinas
Date: Sat Apr 25 2026 - 05:14:55 EST
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().
--
Catalin