From: sashiko-bot@kernel.org
To: "Christian Brauner" <brauner@kernel.org>
Cc: linux-ext4@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
tytso@mit.edu
Subject: Re: [PATCH 8/8] ntfs3: free replaced mount options after a grace period
Date: Fri, 09 Oct 2026 22:02:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-166120@kernel.org> (raw)
In-Reply-To: <20261009-work-fixes-rcu-v1-8-7446d2d335e6@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] ntfs3: use-after-free of sbi->options during concurrent remount
- [Medium] vfs: ntfs3 silent mount option loss on remount
--
commit c093269bafa15fa705cf9dfc3164cc884b583d68
Author: Christian Brauner <brauner@kernel.org>
ntfs3: free replaced mount options after a grace period
This commit introduces an RCU grace period before freeing replaced mount
options in ntfs_fs_reconfigure() to resolve a use-after-free issue in
ntfs_nls_to_utf16() during pathwalks. It also introduces struct rcu_head
into struct ntfs_mount_options and updates readers like
ntfs_nls_to_utf16() to use RCU synchronization.
> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> index 841f9068d82f9..58ef6be3286b1 100644
> --- a/fs/ntfs3/super.c
> +++ b/fs/ntfs3/super.c
> @@ -473,7 +479,15 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
> }
>
> sync_filesystem(sb);
> - swap(sbi->options, fc->fs_private);
> + old_opts = sbi->options;
> + /* pairs with the READ_ONCE() in ntfs_nls_to_utf16() */
> + smp_store_release(&sbi->options, new_opts);
> + fc->fs_private = NULL;
> + /*
> + * ntfs_d_hash() and ntfs_d_compare() of a pathwalk in rcu mode may
> + * still read the old options through the sbi.
> + */
> + call_rcu(&old_opts->rcu, put_mount_options_rcu);
[Severity: High]
Does this change leave other readers of sbi->options vulnerable to a
use-after-free?
While this patch protects ntfs_nls_to_utf16(), other VFS operations appear
to access sbi->options without holding rcu_read_lock() or s_umount. If a
thread is preempted immediately after loading the sbi->options pointer, and
a concurrent mount -o remount calls ntfs_fs_reconfigure() which replaces
sbi->options and schedules its destruction via call_rcu(), the grace period
can complete before the first thread resumes.
For example, during inode initialization:
fs/ntfs3/inode.c:ntfs_read_mft() {
...
inode->i_uid = sbi->options->fs_uid;
inode->i_gid = sbi->options->fs_gid;
...
}
Or during getattr operations:
fs/ntfs3/file.c:ntfs_fileattr_get() {
...
if (sbi->options->nocase)
flags |= FS_CASEFOLD_FL;
...
}
Or during directory traversal:
fs/ntfs3/dir.c:ntfs_dir_emit() {
...
if (!sbi->options->showmeta && ntfs_is_meta_file(sbi, ino))
...
}
Will these unprotected accesses cause memory corruption when the options
are freed by the concurrent remount?
[Severity: Medium]
This problem wasn't introduced by this patch, but doesn't replacing
sbi->options with new_opts cause a silent loss of mount options during
remount?
When a user executes a remount without providing the full set of original
mount options, fc->fs_private is populated with a fresh, default-initialized
options struct in ntfs_init_fs_context():
fs/ntfs3/super.c:ntfs_init_fs_context() {
...
if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE)
goto ok;
...
}
Then in ntfs_fs_reconfigure(), the old options are entirely overwritten by
the new defaults, discarding any unspecified previous settings like uid, gid,
or umask:
smp_store_release(&sbi->options, new_opts);
Can this lead to unintended permission changes or feature toggles by
resetting unspecified options to their default values?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-work-fixes-rcu-v1-0-7446d2d335e6@kernel.org?part=8
next prev parent reply other threads:[~2026-10-09 22:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 21:51 [PATCH 0/8] fs: fix a range of UAFs during rcu pathwalk caused by non-rcu frees Christian Brauner
2026-10-09 21:51 ` [PATCH 1/8] ext4: free the sbi after a grace period Christian Brauner
2026-10-09 22:04 ` sashiko-bot
2026-10-13 12:14 ` Jan Kara
2026-10-09 21:51 ` [PATCH 2/8] afs: free the super info " Christian Brauner
2026-10-09 22:07 ` sashiko-bot
2026-10-10 12:54 ` Christian Brauner
2026-10-09 21:51 ` [PATCH 3/8] 9p: free the session " Christian Brauner
2026-10-09 22:03 ` sashiko-bot
2026-10-09 21:51 ` [PATCH 4/8] eventfs: free the eventfs_inode after an rcu grace period too Christian Brauner
2026-10-09 21:58 ` sashiko-bot
2026-10-09 21:51 ` [PATCH 5/8] ipc: drop the mqueue mount with kern_unmount() on setup failure Christian Brauner
2026-10-09 22:00 ` sashiko-bot
2026-10-09 21:51 ` [PATCH 6/8] unicode: free the map after a grace period Christian Brauner
2026-10-09 22:04 ` sashiko-bot
2026-10-13 12:16 ` Jan Kara
2026-10-09 21:51 ` [PATCH 7/8] ntfs3: free the sbi " Christian Brauner
2026-10-09 22:03 ` sashiko-bot
2026-10-09 21:51 ` [PATCH 8/8] ntfs3: free replaced mount options " Christian Brauner
2026-10-09 22:02 ` sashiko-bot [this message]
2026-10-10 12:55 ` Christian Brauner
2026-10-12 10:36 ` [PATCH 0/8] fs: fix a range of UAFs during rcu pathwalk caused by non-rcu frees Jan Kara
2026-10-12 10:42 ` Christian Brauner
2026-10-13 10:47 ` Jan Kara
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=sashiko-outbox-166120@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=brauner@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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