Re: [PATCH] ring-buffer: Annotate the speculative iterator event copy

From: Steven Rostedt

Date: Thu Nov 12 2026 - 06:08:42 EST


On Wed, 11 Nov 2026 16:42:01 +0800
Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx> wrote:

> A non-consuming iterator can copy an event while the writer overwrites
> its page. The reader lock only excludes other readers, so KCSAN reports
> the memcpy() racing with event reservation.
>
> The iterator already checks the page stamp and committed size after the
> copy and retries if the writer entered the page. Mark the speculative
> copy as an intentional race; only the validated private copy is used.
>
> Fixes: 785888c544e0 ("ring-buffer: Have rb_iter_head_event() handle concurrent writer")

I agree with the change but this isn't a fix. It's just to hide a false
positive from KCSAN. You want to add a fixes tag, add the commit that
introduced KCSAN.

-- Steve