From nobody Fri Dec 30 01:54:16 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NjpGJ5930z2kl2q; Fri, 30 Dec 2022 01:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NjpGJ4FY2z4F1j; Fri, 30 Dec 2022 01:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672365256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gfhRLN9U8pup+sNjryXz5l2A0bAVdANhnzgEgIwcN3c=; b=jDMX3Gl5LhwginUFepgUxr/nFNvlQkD3fEEh2GNIMmU6MaordhStbXBK0Na/UqCJhFwxCV mhRG35mej+p0yUqKaLmBWU22HUzUexY6IlP8QoV6pzuLhEJd90voiLzj/RuC6CnRtuxxjs eq4HRcadjoW9PEiK5nCcIL7xTA2jzo0zgwinmB5thZ0mlu7kKwW3nPiQrEbmIF90kxsH5N XDlzsAouhVJh4RKpPByLU+oANyJ8UCzBJc5npSY9ucq88XNiAl/Mv/ujiVNZZ3KpPSkykd vi8mjUrP8oYmjrwAZkaMIh+mvYB7C7hWtRaWbvmqhE60lp4uAT2GGnFZbiKY0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672365256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gfhRLN9U8pup+sNjryXz5l2A0bAVdANhnzgEgIwcN3c=; b=oOBYsDNNrzTfehn4u860I0nWkLbImcsuUObqHeuQJT+/4H/d6HI7TEiPf7Rqu6asMPib8p GGhUP1cpqNjhqBz0yGQTwG6GsIgW8OGv6wFx1MdvMALEWBmDa8fN9z7W1onH+dr41CgKzh FmU9zzCZYPbGLS48pkeQ2VzYoaqmojzY6tlMQIEneFl+RkFx0+vUIQM0BdIL3fDmFzmbcs kPeGs+asqIeoTZYyUfgo/Uz7GKj9vRIL/q3BvY8twRjWmmq3pNGz/IHRuvfWhqSPDVBeua B2q5QSDYGTUccpp7QHVmruXNuMKr5XlY3gd356zhVFv7BLR1xDIrNNjCCrcrjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672365256; a=rsa-sha256; cv=none; b=W8Pb4Y2b0pFIs/DB2Xn9POKhZjjmBs8xZgYTMuKAM1APh/8iCE2J/xSErqkrnwgrEIz/RY n4t0pqpjTK7/pxhgbHHhs6y6/b380gmh297dzXRUjuDbt/dZLiS2Njp19AzSQZvX1+NmCg cPxY2PM+Qoxz7miCZguVmh0eTwHfdZPH4vUyPE/z5su43SrnMPXNcklYn7ioQn7hu+scTq NPWRQ1tlOp0I/ojXNpGnldfQIqRr5OyAUVGclKWJE692kbPjKkcz7gbnxjtyjwQwBoAgAG Ow67Jhn6N+eRUjP9naB9WrO7IxPfA0G75aVe2pUweIHb1IOCPTfWxXmlJp8K0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NjpGJ32qVzr0q; Fri, 30 Dec 2022 01:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BU1sGBP077666; Fri, 30 Dec 2022 01:54:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BU1sGMg077665; Fri, 30 Dec 2022 01:54:16 GMT (envelope-from git) Date: Fri, 30 Dec 2022 01:54:16 GMT Message-Id: <202212300154.2BU1sGMg077665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 6e227714e9a5 - stable/13 - vfs_mount.c: fix vfs_domount() for PRIV_VFS_MOUNT_EXPORTED List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6e227714e9a58007a30d7afb8f14bfffd321109c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=6e227714e9a58007a30d7afb8f14bfffd321109c commit 6e227714e9a58007a30d7afb8f14bfffd321109c Author: Rick Macklem AuthorDate: 2022-12-16 21:01:23 +0000 Commit: Rick Macklem CommitDate: 2022-12-30 01:53:23 +0000 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. (cherry picked from commit 195f1b124da4bf73d951cd251dffd9485672fe0a) --- sys/kern/vfs_mount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 6e2945c91e1c..d17e1c7fbbd7 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -781,6 +781,8 @@ vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions) fsflags |= MNT_SYNCHRONOUS; else if (strcmp(opt->name, "union") == 0) fsflags |= MNT_UNION; + else if (strcmp(opt->name, "export") == 0) + fsflags |= MNT_EXPORTED; else if (strcmp(opt->name, "automounted") == 0) { fsflags |= MNT_AUTOMOUNTED; do_freeopt = 1;