linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gong, Sishuai" <sishuai@purdue.edu>
To: "viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: A data race on mnt->mnt.mnt_flags
Date: Mon, 29 May 2023 20:38:28 +0000	[thread overview]
Message-ID: <BE49328F-DC47-4509-AC7E-6DD6FEC2FF83@purdue.edu> (raw)

Hello,

We found a data race that could happen between clone_mnt() and
mnt_hold_writers() over mnt->mnt.mnt_flags.

The two functions can write to mnt->mnt.mnt_flags concurrently.
Although mnt_hold_writers() holds the lock_mount_hash(), clone_mnt() does not
respect this lock at this moment (it will apply for this lock later).

Thread-1					Thread-2
// clone_mnt()				// mnt_hold_writers() holding lock_mount_hash()
mnt->mnt.mnt_flags &= ~(MNT_WRITE_HOLD|MNT_MARKED|MNT_INTERNAL);
						mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;

It is not clear whether this is a serious problem but we would like to report it
just in case.

Thanks,
Sishuai

                 reply	other threads:[~2023-05-29 20:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=BE49328F-DC47-4509-AC7E-6DD6FEC2FF83@purdue.edu \
    --to=sishuai@purdue.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).