From: Arefev <arefev@swemel.ru>
To: Jan Kara <jack@suse.cz>, Al Viro <viro@zeniv.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org, stable@vger.kernel.org
Subject: Re: [PATCH] make new mount API honour SB_NOUSER (was Re: [PATCH] block: Avoid mounting the bdev pseudo-filesystem in userspace)
Date: Tue, 2 Jun 2026 16:23:21 +0300 [thread overview]
Message-ID: <b106ed26-e6ec-4254-b337-1d2e8e2adc58@swemel.ru> (raw)
In-Reply-To: <eevyuiiqt5b4n7kws2lc24jk2njdllanojl76t5cftx6he6hba@y46tiknbebj4>
02.06.2026 12:11, Jan Kara пишет:
> On Tue 02-06-26 03:04:44, Al Viro wrote:
>> one should *not* be allowed to mount one of those, new API or not.
>>
>> Reported-by: Denis Arefev <arefev@swemel.ru>
>> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> Won't it make sense to actually check fc->sb_flags before we call
> vfs_create_mount()? Otherwise it looks good to me.
>
> Honza
Hi all.
The sequence of system calls before the crash could be as follows:
fsopen("bdev", ...)
fsconfig(fd_fs, FSCONFIG_CMD_CREATE, 0,0,0)
fsmount(fd_fs, 0,0)
move_mount(fd_mnt, "", AT_FDCWD, "./file1", 0x46ul)
The system call executed at the time of the cras:
open("/dev/media0", ...);
Simplified stacktrace:
path_openat
|-> link_path_walk
|-> walk_component
|-> __lookup_slow
|-> ld = inode->i_op->lookup(inode, dentry, flags); <- Oops
Searching for possible solutions in the commit history yielded the
following result:
commit fd3e007f6c6a0f677e4ee8aca4b9bab8ad6cab9a
commit 1a6e9e76b713d9632783efe78295ed3507fdad64
commit d6f2589ad561aa5fa39f347eca6942668b7560a1
Checking the fc->sb_flags flag before calling vfs_create_mount() is a
great idea,
if it helps prevent crashes in two more file systems, 'sockfs' and 'pipefs'.
Best regards, Denis.
>
>> ---
>> [[ I still want to see the rest of the reproducer - report smells like a missing
>> d_can_lookup() somewhere, on top of fsmount(2) bug]]
>> diff --git a/fs/namespace.c b/fs/namespace.c
>> index fe919abd2f01..17777c837683 100644
>> --- a/fs/namespace.c
>> +++ b/fs/namespace.c
>> @@ -4499,6 +4499,10 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags,
>> new_mnt = vfs_create_mount(fc);
>> if (IS_ERR(new_mnt))
>> return PTR_ERR(new_mnt);
>> + if (new_mnt->mnt_sb->s_flags & SB_NOUSER) {
>> + mntput(new_mnt);
>> + return -EINVAL;
>> + }
>> new_mnt->mnt_flags = mnt_flags;
>>
>> new_path.dentry = dget(fc->root);
next prev parent reply other threads:[~2026-06-02 13:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 7:28 [PATCH] block: Avoid mounting the bdev pseudo-filesystem in userspace Denis Arefev
2026-05-25 6:07 ` Christoph Hellwig
2026-06-02 1:21 ` Al Viro
2026-05-26 16:37 ` Jens Axboe
2026-06-02 1:19 ` Al Viro
2026-06-02 1:35 ` Al Viro
2026-06-02 2:04 ` [PATCH] make new mount API honour SB_NOUSER (was Re: [PATCH] block: Avoid mounting the bdev pseudo-filesystem in userspace) Al Viro
2026-06-02 9:11 ` Jan Kara
2026-06-02 13:23 ` Arefev [this message]
2026-06-02 14:54 ` Al Viro
2026-06-02 14:07 ` Al Viro
2026-06-08 10:22 ` Jan Kara
2026-06-02 14:55 ` Christian Brauner
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=b106ed26-e6ec-4254-b337-1d2e8e2adc58@swemel.ru \
--to=arefev@swemel.ru \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®