From: Greg KH <gregkh@linuxfoundation.org>
To: Cen Zhang <zzzccc427@gmail.com>
Cc: jirislaby@kernel.org, peter@hurleysoftware.com,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
baijiaju1990@gmail.com
Subject: Re: [PATCH] tty: n_tty: order lockless input availability checks
Date: Mon, 4 May 2026 09:53:31 +0200 [thread overview]
Message-ID: <2026050455-secret-monetary-bb37@gregkh> (raw)
In-Reply-To: <CAFRLqsVMYRESR4dhpcsxXF17FvaX5obXyT0ZXZMkHymnw-6K6Q@mail.gmail.com>
On Mon, May 04, 2026 at 03:47:01PM +0800, Cen Zhang wrote:
> Dear Greg KH
>
> Thanks for taking a look, and sorry if the changelog made this sound
> stronger than the evidence I have.
>
> > What tests show that this is needed? That commit was a long time ago,
> > and surely we would have had some bug reports since then, right?
> >
> > thanks,
> >
> > greg k-h
>
> The evidence I have is from data-race reports produced while stressing
> pty/tty ioctls. The relevant stacks, mapped to current v7.0.3 source,
> are:
Cool, where are those reports?
> - read/unthrottle side:
> chars_in_buffer() at drivers/tty/n_tty.c:216
> n_tty_check_unthrottle() at drivers/tty/n_tty.c:275
> n_tty_read()
>
> racing with the receive side:
> n_tty_receive_char_canon() at drivers/tty/n_tty.c:1258
> __receive_buf() at drivers/tty/n_tty.c:1588
>
> - poll/select side:
> input_available_p() at drivers/tty/n_tty.c:1912-1915
> n_tty_poll() at drivers/tty/n_tty.c:2440/2444
>
> racing with termios changes:
> n_tty_set_termios() at drivers/tty/n_tty.c:1782,
> drivers/tty/n_tty.c:1786 and drivers/tty/n_tty.c:1789
>
> My reasoning was that these helpers sample the same lockless read-buffer
> availability state that the read/copy paths already handle with
> smp_store_release()/smp_load_acquire(), but I do not have a test showing
> a concrete functional failure beyond the data-race reports.
>
> Would you prefer that I drop the Fixes tag and respin the changelog to
> describe this as a conservative KCSAN/LKMM cleanup? Or do you think the
> evidence is too weak for a change here?
I don't really know as I haven't seen any such reports before that I can
recall.
thanks,
greg k-h
next prev parent reply other threads:[~2026-05-04 7:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 7:23 [PATCH] tty: n_tty: order lockless input availability checks Cen Zhang
2026-05-04 7:34 ` Greg KH
2026-05-04 7:47 ` Cen Zhang
2026-05-04 7:53 ` Greg KH [this message]
2026-05-04 8:11 ` Cen Zhang
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=2026050455-secret-monetary-bb37@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=baijiaju1990@gmail.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=peter@hurleysoftware.com \
--cc=zzzccc427@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox