From: Uladzislau Rezki <urezki@gmail.com>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
Shaobo Huang <huangshaobo3@xiaomi.com>
Cc: Shaobo Huang <huangshaobo3@xiaomi.com>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, akpm@linux-foundation.org,
david@kernel.org, kees@kernel.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, kprateek.nayak@amd.com, liam@infradead.org,
vbabka@kernel.org, rppt@kernel.org, surenb@google.com,
mhocko@suse.com, ryabinin.a.a@gmail.com, glider@google.com,
andreyknvl@gmail.com, dvyukov@google.com,
vincenzo.frascino@arm.com, kasan-dev@googlegroups.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Uladzislau Rezki <urezki@gmail.com>
Subject: Re: [PATCH v2] fork: reset pointer tag of vmapped thread stack before vfree
Date: Tue, 15 Sep 2026 16:49:12 +0200 [thread overview]
Message-ID: <aqla6CyhEPihIznP@milan> (raw)
In-Reply-To: <aqfBDEkiRmlb0WWZ@gremlin>
On Mon, Sep 14, 2026 at 10:44:26AM +0100, Lorenzo Stoakes (ARM) wrote:
> +cc Ulad for vmalloc stuff.
>
> Please don't send a v2 in-reply-to a v1 or any other email.
>
> Send the patch entirely separately.
>
> I really need to write a bot to say this :)...
>
> On Mon, Sep 14, 2026 at 05:33:00PM +0800, Shaobo Huang wrote:
> > 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.
> >
> > Fixes: 9f7d416c3612 ("kprobes: Unpoison stack in jprobe_return() for KASAN")
> > Cc: stable@vger.kernel.org
> > Assisted-by: zhipuai:glm-5.2
>
> Thanks for adding this!
>
> New convention is to say:
>
> Assisted-by: LLM
>
> Rather than to list the agent.
>
> See https://docs.kernel.org/process/coding-assistants.html
>
> > Signed-off-by: Shaobo Huang <huangshaobo3@xiaomi.com>
>
> Looks reasonable to me so, with nits addressed:
>
> Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
>
> But I would like Ulad's input on this from vmalloc side.
>
Makes sense to me even though we do it in the __find_vmap_area()
but we also use an "addr" in other paths.
LGTM:
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
next prev parent reply other threads:[~2026-09-15 14:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 12:30 [PATCH] fork: reset pointer tag of vmapped thread stack before vfree sparkhuang
2026-08-06 14:13 ` Lorenzo Stoakes (ARM)
2026-08-07 6:53 ` sparkhuang
2026-08-07 7:56 ` Lorenzo Stoakes (ARM)
2026-08-07 7:57 ` David Hildenbrand (Arm)
2026-08-07 7:58 ` Lorenzo Stoakes (ARM)
2026-08-07 8:00 ` David Hildenbrand (Arm)
2026-09-14 9:19 ` Shaobo Huang
2026-08-07 9:27 ` David Hildenbrand (Arm)
2026-08-07 10:41 ` sparkhuang
2026-08-07 10:47 ` David Hildenbrand (Arm)
2026-08-07 11:20 ` David Hildenbrand (Arm)
2026-09-14 9:33 ` [PATCH v2] " Shaobo Huang
2026-09-14 9:44 ` Lorenzo Stoakes (ARM)
2026-09-15 14:49 ` Uladzislau Rezki [this message]
2026-09-16 17:45 ` Andrey Ryabinin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqla6CyhEPihIznP@milan \
--to=urezki@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=bsegall@google.com \
--cc=david@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=huangshaobo3@xiaomi.com \
--cc=juri.lelli@redhat.com \
--cc=kasan-dev@googlegroups.com \
--cc=kees@kernel.org \
--cc=kprateek.nayak@amd.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vincenzo.frascino@arm.com \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.