HomeFreeBSD

vfs_mount.c: fix vfs_domount() for PRIV_VFS_MOUNT_EXPORTED

Description

vfs_mount.c: fix vfs_domount() for PRIV_VFS_MOUNT_EXPORTED

It appears that, prior to r158857 vfs_domount() checked
suser() when MNT_EXPORTED was specified.

r158857 appears to have broken this, since MNT_EXPORTED
was no longer set when mountd.c was converted to use nmount(2).
r164033 replaced the suser() check with
priv_check(td, PRIV_VFS_MOUNT_EXPORTED), which does the
same thing (ie. checks for effective uid == 0 assuming suses_enabled
is set).

This patch restores this check by setting MNT_EXPORTED when the
"export" mount option is specified to nmount().

I think this is reasonable since only mountd(8) should be setting
exports and I doubt any non-root mounted file system would
be setting its own exports.

Reviewed by: kib, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37718

Details

Provenance
rmacklemAuthored on Dec 16 2022, 9:01 PM
Reviewer
kib
Differential Revision
D37718: fix vfs_domount() so that it check PRIV_VFS_MOUNT_EXPORTED
Parents
rG8fb9739615da: wg: Re-add basic if_wg(4) tests.
Branches
Unknown
Tags
Unknown