[lvc-project] [PATCH] block: Avoid mounting the bdev pseudo-filesystem in userspace
Al Viro
viro at zeniv.linux.org.uk
Tue Jun 2 04:35:26 MSK 2026
On Tue, Jun 02, 2026 at 02:19:07AM +0100, Al Viro wrote:
> On Thu, May 21, 2026 at 10:28:56AM +0300, Denis Arefev wrote:
> > The bdev pseudo-filesystem is an internal kernel filesystem with which
> > userspace should not interfere. Unregister it so that userspace cannot
> > even attempt to mount it.
> >
> > This fixes a bug [1] that occurs when attempting to access files,
> > because the system call move_mount() uses pointers declared in the
> > inode_operations structure, which for the bdev pseudo-filesystem
> > are always equal to 0. `inode->i_op = &empty_iops;`
>
> What? init_pseudo() sets SB_NOUSER; what are you talking about?
... which doesn't suffice, apparently, since now bdev has become
mountable, along with the rest of pseudo-fs. *THAT* is a bug.
> And assuming you've somehow managed to mount the sucker, which
> ->i_op method had been accessed?
->lookup(), apparently. Which means that 'directory' should've been
rejected by d_can_lookup(), no matter which filesystem it's been
from. Which might or might not be a bug in its own right.
In any case, NAK on that patch - it's papering over the real bug that
has nothing to do with block layer.
mount -t bdev none /mnt
must fail, same as for pipefs, sockfs, etc. It doesn't.
fsdevel Cc'd, as it should've been from the very beginning.
More information about the lvc-project
mailing list