public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Ignacio Encinas <ignacio@iencinas.com>
Cc: Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Christian Schoenebeck <linux_oss@crudebyte.com>,
	Sishuai Gong <sishuai.system@gmail.com>,
	Marco Elver <elver@google.com>,
	v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org,
	syzbot+d69a7cc8c683c2cb7506@syzkaller.appspotmail.com,
	syzbot+483d6c9b9231ea7e1851@syzkaller.appspotmail.com
Subject: Re: [PATCH v3] 9p/trans_fd: mark concurrent read and writes to p9_conn->err
Date: Wed, 19 Mar 2025 07:01:11 +0900	[thread overview]
Message-ID: <Z9ntJxTCg2Y0fcRc@codewreck.org> (raw)
In-Reply-To: <20250318-p9_conn_err_benign_data_race-v3-1-290bb18335cc@iencinas.com>

Ignacio Encinas wrote on Tue, Mar 18, 2025 at 10:39:02PM +0100:
> Writes for the error value of a connection are spinlock-protected inside
> p9_conn_cancel, but lockless reads are present elsewhere to avoid
> performing unnecessary work after an error has been met.
> 
> Mark the write and lockless reads to make KCSAN happy. Mark the write as
> exclusive following the recommendation in "Lock-Protected Writes with
> Lockless Reads" in tools/memory-model/Documentation/access-marking.txt
> while we are at it.
> 
> Mark p9_fd_request and p9_conn_cancel m->err reads despite the fact that
> they do not race with concurrent writes for stylistic reasons.
> 
> Reported-by: syzbot+d69a7cc8c683c2cb7506@syzkaller.appspotmail.com
> Reported-by: syzbot+483d6c9b9231ea7e1851@syzkaller.appspotmail.com
> Signed-off-by: Ignacio Encinas <ignacio@iencinas.com>
> ---
> Changes in v3:
> 
> - Introduce a couple of extra READ_ONCEs to maintain consistency across
>   m->err reads (noted in the commit message too for future reference)
> - Remove racy read from p9_fd_request by reusing the previously read
>   error (arguably, the lock was never of much use)

Thank you!

I've updated the patch in my -next branch, and it'll go to Linus in a
couple of weeks with the 6.15 merge window

(our mails crossed, feel free to ignore the other one)
-- 
Dominique

      reply	other threads:[~2025-03-18 22:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 21:39 [PATCH v3] 9p/trans_fd: mark concurrent read and writes to p9_conn->err Ignacio Encinas
2025-03-18 22:01 ` Dominique Martinet [this message]

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=Z9ntJxTCg2Y0fcRc@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=elver@google.com \
    --cc=ericvh@kernel.org \
    --cc=ignacio@iencinas.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=sishuai.system@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+483d6c9b9231ea7e1851@syzkaller.appspotmail.com \
    --cc=syzbot+d69a7cc8c683c2cb7506@syzkaller.appspotmail.com \
    --cc=v9fs@lists.linux.dev \
    /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