Re: [PATCH v10 2/4] tracing: Fix subbuf resize races with trace_pipe_raw readers

From: Steven Rostedt

Date: Fri Sep 04 2026 - 15:13:59 EST


On Fri, 4 Sep 2026 14:35:27 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> > + } else if (!i) {
> > + /*
> > + * We failed to read because the length is too small
> > + * or unaligned. If this is the first iteration, it's
> > + * an invalid userspace input. Otherwise, this is due
> > + * to a subbuf order change. Do not report an error
> > + * and just finish the read.
>
> This isn't quite true. It can be an invalid length and not the first
> iteration. If you ask for a length that isn't subbuffer aligned but greater
> than one subbuffer in size it will work the first iteration but fail at the
> end where it couldn't get a full page.
>
> That is valid but would also trigger this path.
>
> This is the only issue I have with this patch set. I'll just take it as is
> now. We can fix the comment later. I want to start testing it and get it to
> Linus before the next RC release is out. If it fails the tests, then we can
> fix the comment as it will not make the next release.

After re-reading your comment I see what you meant. But it is still
incorrect because it sounds like the only way for it to not be invalid on
the second or later iteration is due to a subbuf order change. That is
actually the unlikely case.

I'll add a patch to fix this.

-- Steve