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

From: Catalin Marinas

Date: Wed Apr 29 2026 - 10:48:34 EST


On Wed, Apr 29, 2026 at 03:57:03PM +0530, Dev Jain wrote:
> From: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
>
> 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@xxxxxxx>
> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>

Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>