Skip to contentSkip to conversation

kasan-skip-hw-tagging-for-all-kernel-thread-stacks.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kasan: skip HW tagging for all kernel thread stacks
has been removed from the -mm tree. Its filename was
kasan-skip-hw-tagging-for-all-kernel-thread-stacks.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Muhammad Usama Anjum <[email protected]>
Subject: kasan: skip HW tagging for all kernel thread stacks
Date: Wed, 29 Apr 2026 15:57:03 +0530

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.

Cc Arnd Bergmann <[email protected]>
Cc Ben Segall <[email protected]>
Cc David Hildenbrand (Arm) <[email protected]>
Cc Dietmar Eggemann <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Juri Lelli <[email protected]>
Cc Kees Cook <[email protected]>
Cc K Prateek Nayak <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc "Uladzislau Rezki (Sony)" <[email protected]>
Cc Valentin Schneider <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 include/linux/thread_info.h |    2 +-
 kernel/fork.c               |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
include/linux/thread_info.h renamed from include/linux/thread_info.h~kasan-skip-hw-tagging-for-all-kernel-thread-stacks +1 -1
@@ -92,7 +92,7 @@ static inline long set_restart_fn(struct
 #define THREAD_ALIGN	THREAD_SIZE
 #endif
 
-#define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_ZERO)
+#define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_ZERO | __GFP_SKIP_KASAN)
 
 /*
  * flag set/clear/test wrappers
kernel/fork.c renamed from kernel/fork.c~kasan-skip-hw-tagging-for-all-kernel-thread-stacks +3 -2
@@ -204,7 +204,7 @@ static DEFINE_PER_CPU(struct vm_struct *
  * accounting is performed by the code assigning/releasing stacks to tasks.
  * We need a zeroed memory without __GFP_ACCOUNT.
  */
-#define GFP_VMAP_STACK (GFP_KERNEL | __GFP_ZERO)
+#define GFP_VMAP_STACK (GFP_KERNEL | __GFP_ZERO | __GFP_SKIP_KASAN)
 
 struct vm_stack {
 	struct rcu_head rcu;
@@ -342,7 +342,8 @@ static int alloc_thread_stack_node(struc
 		}
 
 		/* Reset stack metadata. */
-		kasan_unpoison_range(vm_area->addr, THREAD_SIZE);
+		if (!kasan_hw_tags_enabled())
+			kasan_unpoison_range(vm_area->addr, THREAD_SIZE);
 
 		stack = kasan_reset_tag(vm_area->addr);
 

_

Patches currently in -mm which might be from [email protected] are