The backing file is already opened successfully, so there is
no need to override the permissions.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 75574 Build 72457: arc lint + arc unit
Event Timeline
This check has nothing to do with opening the tar file. It checks if the calling process is allowed to mount file systems.
I mean that the backing file's permissions have already been checked since it has been successfully opened at that point, and the calling process's privilege to mount is checked elsewhere. Isn't that already checked in sys/kern/vfs_mount.c:vfs_domount()?
Plenty of other file systems have the same check. If you're convinced that it's unnecessary I would suggest you post a patch that removes it from all of them, not just tarfs, and circulate it more widely.
Correct me if my understanding is wrong, but they seem necessary in the other places. All other instances are like this:
/* Check the access rights on the mount device */
error = VOP_ACCESS(devvp, accmode, td->td_ucred, td);
if (error)
error = priv_check(td, PRIV_VFS_MOUNT_PERM);
if (error) {
vput(devvp);
return (error);
}They are all bypassing the VOP_ACCESS check (thus overriding dev node perms as the description of PRIV_VFS_MOUNT_PERM says) if the caller has PRIV_VFS_MOUNT_PERM. However, in tarfs, at that point in the code, VOP_ACCESS is already checked through vn_open_vnode. There should be nothing to override here.