The source project of this merge request has been removed.
Do not open special files for `mount_fds`
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 (merged) (“Create file handles”, commit hash a80c3be3). Thanks to Dave for noticing this in the C virtiofsd series!