[Virtio-fs] [virtiofsd-rs] MR merged: Fix file type check for submount points

virtiofs-bot at sinrega.org virtiofs-bot at sinrega.org
Fri Jun 11 08:52:17 UTC 2021


The current check (`mode & IFDIR != 0`) only kind of works accidentally.
It should be `mode & IFMT == IFDIR`.

Judging from my bits/stat.h, block devices and sockets would also pass
the `mode & IFDIR != 0` condition.  That is not exactly catastrophic, we
just never tested what happens what happens if we were to mark something
that is not a directory a submount, and so we only allow directories to
be submount points until someone needs guest submounts for mount points
that are not directories.

Note that the kernel also has a guard to only allow submounts on
directory nodes, so in practice this patch should not change any
user-visible behavior.
---
https://gitlab.com/virtio-fs/virtiofsd-rs/-/merge_requests/30




More information about the Virtio-fs mailing list