Page MenuHomeFreeBSD

tarfs: remove PRIV_VFS_MOUNT_PERM check
AcceptedPublic

Authored by siva on Thu, Aug 13, 6:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Aug 13, 6:57 PM
Unknown Object (File)
Thu, Aug 13, 6:57 PM
Subscribers

Details

Reviewers
des
stevek
Summary

The backing file is already opened successfully, so there is
no need to override the permissions.

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

siva requested review of this revision.Thu, Aug 13, 6:51 PM
des requested changes to this revision.Thu, Aug 13, 9:50 PM

This check has nothing to do with opening the tar file. It checks if the calling process is allowed to mount file systems.

This revision now requires changes to proceed.Thu, Aug 13, 9:50 PM

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()?

https://cgit.freebsd.org/src/tree/sys/kern/vfs_mount.c?id=9f5c4ef32812afb4573a278e6eafe5040f839d13#n1652

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.

This revision is now accepted and ready to land.Fri, Aug 14, 2:22 PM