From: Andrew Morton <akpm@linux-foundation.org>
To: "Hui Zhu" <hui.zhu@linux.dev>
Cc: "Liam R. Howlett" <liam@infradead.org>,
Alice Ryhl <aliceryhl@google.com>,
Andrew Ballance <andrewjballance@gmail.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org,
linux-mm@kvack.org, Hui Zhu <zhuhui@kylinos.cn>
Subject: Re: [PATCH] maple_tree: Annotate lockless pivot reads for KCSAN
Date: Wed, 26 Aug 2026 09:41:47 -0700 [thread overview]
Message-ID: <20260826094147.42e1e71e91a5a537ced30a21@linux-foundation.org> (raw)
In-Reply-To: <20260826074430.1139325-1-hui.zhu@linux.dev>
On Wed, 26 Aug 2026 15:44:30 +0800 "Hui Zhu" <hui.zhu@linux.dev> wrote:
> In RCU mode, replaced maple nodes are marked dead and freed via RCU
> after the new node has been published. Arming the RCU free writes
> node->rcu.next and node->rcu.func, which share storage with
> pivot[0] and pivot[1] (see struct maple_node), while lockless
> readers may still walk the dead node. These stores therefore race
> with the pivot loads performed by the walkers.
>
> This is harmless: the writer marks the node dead with an smp_wmb()
> before arming the rcu_head, and the walkers re-check ma_dead_node()
> after reading the node and restart the walk when the node is dead,
> so any pivot read that raced with the rcu_head stores is discarded.
> KCSAN cannot see this protocol and reports the plain accesses, so
> annotate the lockless pivot reads with data_race() through a new
> ma_pivot_rcu() helper.
>
> Found by fuzzing on a 6.6 kernel; the race still exists on
> mainline. No functional change intended.
Thanks. AI review suggests that the patch is correct, but incomplete?
https://sashiko.dev/#/patchset/20260826074430.1139325-1-hui.zhu@linux.dev
next prev parent reply other threads:[~2026-08-26 16:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 7:44 [PATCH] maple_tree: Annotate lockless pivot reads for KCSAN Hui Zhu
2026-08-26 16:41 ` Andrew Morton [this message]
2026-08-27 2:46 ` Liam R. Howlett
2026-08-27 5:35 ` Hui Zhu
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=20260826094147.42e1e71e91a5a537ced30a21@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=andrewjballance@gmail.com \
--cc=hui.zhu@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=willy@infradead.org \
--cc=zhuhui@kylinos.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox