[Virtio-fs] [virtiofsd-rs] MR merged: Do not open special files for `mount_fds`

virtiofs-bot at sinrega.org virtiofs-bot at sinrega.org
Fri Jun 11 08:49:27 UTC 2021


We must not open special files (i.e. anything but regular files and
directories) with any flag but `O_PATH`.  Right now,
`from_name_at_with_mount_fds()` opens files indiscriminately of their
type, and so this is wrong.

Instead, open the file with `O_PATH` first and use the information we
get from `statx()` (which we call anyway) to determine whether it is
safe to reopen this file with `O_RDONLY`.

This is a follow-up fix for patch 8 in merge request !26 (“Create file handles�, commit hash a80c3be3c59c9c2aaae3a90ebef2b72d151a2e4c). Thanks to Dave for noticing this in the C virtiofsd series!
---
https://gitlab.com/virtio-fs/virtiofsd-rs/-/merge_requests/29




More information about the Virtio-fs mailing list