Re: [PATCH v4 2/3] kasan: skip HW tagging for all kernel thread stacks

Catalin Marinas
2026-04-29T14:43:36Z

On Wed, Apr 29, 2026 at 03:57:03PM +0530, Dev Jain wrote:
> From: Muhammad Usama Anjum <usama.anjum@arm.com>
>
> HW-tag KASAN never checks kernel stacks because stack pointers carry the
> match-all tag, so setting/poisoning tags is pure overhead.
>
> - Add __GFP_SKIP_KASAN to THREADINFO_GFP so every stack allocator that
> uses it skips tagging (fork path plus arch users)
> - Add __GFP_SKIP_KASAN to GFP_VMAP_STACK for the fork-specific vmap
> stacks.
> - When reusing cached vmap stacks, skip kasan_unpoison_range() if HW tags
> are enabled.
>
> Software KASAN is unchanged; this only affects tag-based KASAN.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
> Signed-off-by: Dev Jain <dev.jain@arm.com>