* [alternative-merged] fork-reset-pointer-tag-of-vmapped-thread-stack-before-vfree.patch removed from -mm tree
@ 2026-09-16 21:00 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-09-16 21:00 UTC (permalink / raw)
To: mm-commits, vschneid, vincenzo.frascino, vincent.guittot, vbabka,
urezki, surenb, stable, ryabinin.a.a, rppt, rostedt, peterz,
mingo, mhocko, mgorman, ljs, liam, kprateek.nayak, kees,
juri.lelli, glider, dvyukov, dietmar.eggemann, david, bsegall,
andreyknvl, huangshaobo3, akpm
The quilt patch titled
Subject: fork: reset pointer tag of vmapped thread stack before vfree
has been removed from the -mm tree. Its filename was
fork-reset-pointer-tag-of-vmapped-thread-stack-before-vfree.patch
This patch was dropped because an alternative patch was or shall be merged
------------------------------------------------------
From: Shaobo Huang <huangshaobo3@xiaomi.com>
Subject: fork: reset pointer tag of vmapped thread stack before vfree
Date: Mon, 14 Sep 2026 17:33:00 +0800
thread_stack_free_rcu() frees the vmalloc'd thread stack via
vfree(vm_area->addr). In RCU callback context, vfree() routes to
vfree_atomic(), which calls llist_add((struct llist_node *)addr, ...) and
writes 8 bytes to the base of the region being freed.
With KASAN_SW_TAGS, vm_area->addr carries a random tag. If
kasan_unpoison_task_stack_below() has rewritten the shadow covering [base,
sp] to KASAN_TAG_KERNEL (0xff) -- which it does on every CPU resume for
the current task's stack -- the llist_add store checks shadow[base] (0xff)
against the pointer tag (random) and reports an invalid-access, although
writing to the base of a stack queued for deferred free is legitimate.
Reset the pointer tag to KASAN_TAG_KERNEL before vfree() so that
kasan_check_range() short-circuits the check, the same way the task
accesses its own stack at runtime via sp. The vmalloc lookup is safe:
__find_vmap_area() resets the tag before comparing against va_start.
Link: https://lore.kernel.org/20260914093300.100495-1-huangshaobo3@xiaomi.com
Fixes: 9f7d416c3612 ("kprobes: Unpoison stack in jprobe_return() for KASAN")
Assisted-by: zhipuai:glm-5.2
Signed-off-by: Shaobo Huang <huangshaobo3@xiaomi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Ben Segall <bsegall@google.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: <stable@vger.kernel.org>
---
kernel/fork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kernel/fork.c~fork-reset-pointer-tag-of-vmapped-thread-stack-before-vfree
+++ a/kernel/fork.c
@@ -280,7 +280,7 @@ static void thread_stack_free_rcu(struct
if (try_release_thread_stack_to_cache(vm_stack->stack_vm_area))
return;
- vfree(vm_area->addr);
+ vfree(kasan_reset_tag(vm_area->addr));
}
static void thread_stack_delayed_free(struct task_struct *tsk)
_
Patches currently in -mm which might be from huangshaobo3@xiaomi.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-16 21:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-16 21:00 [alternative-merged] fork-reset-pointer-tag-of-vmapped-thread-stack-before-vfree.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.