From nobody Tue Nov 17 17:08:14 2026 X-Original-To: dev-commits-src-all@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 4jTWQR0R3Hz71SG0 for ; Tue, 17 Nov 2026 17:08:15 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTWQQ5SV2z4Mrv for ; Tue, 17 Nov 2026 17:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DrWOmfzVx/yX3VhtCm4Bi4EAtMbdYnFKZaHo6bfXk6E=; b=Vh0hXFX0PpTzwd9z6Ziw1zl5WxJBGx4q3OVW8uU015xE2z11hoEs8x0EQLRbDumNWiPyrz GNg7TxbgjT6up73ACOxIBX8nfW9YrAnNkXCep/JRxghKdNhN2p02zr8tpkpNUv8ns2xUNm M2W69hJDpWPqryPUA4JtRRRK+IhAailEzjCvgBQfQNiOGQmJXjp/MW2lgLh8HGY4CDYGSq gFW5V8PNzNNWDmQij0rbSZjRCDJKYnZwEXHVSamU8w1feArihasXUAHf3GhwRLZY3sEGUO tfYPbvYAd3bWW5ODvMTcsJknfQU8hQDwv2U6KDNDDAd79yXCDxnQs4nRsfVEPw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794935294; b=htgMHvQ6aN+D0OynCl1t/sUYzbC81LxkhR0hBnH4qrHRDwGKsHggpVIS8NFtE6OAvP3xIv mNCyTpb15JqobFD8nCXx5ZL/TXKhHR293TSDCR9HDMko1OFRLfl8Bx59JNPa6GMxk7r6lv 650FP/wuXWUxfX+UB+12dT9AzuWKG6QgaEILnECDUizer9l6iVmrkYXPlHin5lMY48CvyG YcXmIA+NwGuAsY97ryhj25hbP8zwPmoNQcah2+0Zovhdde12Qmhbt8T8Ik9aVfQIex3QTZ UFSq7pJfafyA1LFaYSZ/XYz6MLAsQnQ7wMrnAFBzdO7tZ99m+r4BaW0A35bigA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DrWOmfzVx/yX3VhtCm4Bi4EAtMbdYnFKZaHo6bfXk6E=; b=NH7GEfFCFEcEET8riNUalpotlS+y1fuqn3TvQxYOeDBHIC7cua0Pv/vAYYoPoK+6Gi7Z2l 7WrDYWjyOrFnHi3cHewcLCODNfd5J8ETw8CZfepSR5pxSGSUZ4TQsW1yGODJBXzKElW+wF Csm+liAzi4uEMMQuQy3L8dhLR6+gfcCs4sECooStOY0wZMxbOqZZXslxoPi83rLeVS+E1a SI9mPKoQWBTs/aq29oe3cC1IZglR4QWHucNgDCYgeFKv22HEMeILNXyHWpSaB6Q43pydPc Nfz2MB+nUbCchYcn0Vci2FVfpdAN+7D90oMSE2SdEomkuiKXedvCAuVHIzxwYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTWQQ56JyzrsN for ; Tue, 17 Nov 2026 17:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e34d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:08:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Konstantin Belousov From: Mark Johnston Subject: git: 479b92177bd9 - releng/15.1 - rbeneath lookup: move the boundary on union mount fallthrough List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.1 X-Git-Reftype: branch X-Git-Commit: 479b92177bd93d99ae9b041076e459a2fb161049 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:08:14 +0000 Message-Id: <6afc89fe.1e34d.68e04166@gitrepo.freebsd.org> The branch releng/15.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=479b92177bd93d99ae9b041076e459a2fb161049 commit 479b92177bd93d99ae9b041076e459a2fb161049 Author: Konstantin Belousov AuthorDate: 2026-11-12 20:00:17 +0000 Commit: Mark Johnston CommitDate: 2026-11-16 21:21:09 +0000 rbeneath lookup: move the boundary on union mount fallthrough A name not found in the root of a union (MNT_UNION) mount is looked up in the covered directory. If the union root is the starting directory of a strict relative lookup and the name is a relative symlink in the covered directory, namei() resolves the symlink target from ni_dvp, the covered vnode, without crossing back into the union root. A ".." in the target is then checked against ni_rbeneath_dpp, the union root, which does not match, and the lookup leaves the starting directory. Before 2f60984053 the fallthrough added the covered vnode to the visited vnodes, and the parent of the covered directory, never visited, was refused. When the fallthrough happens at ni_rbeneath_dpp, move ni_rbeneath_dpp to the covered vnode. ".." from the union root steps over mnt_vnodecovered in the vfs_lookup() dotdot loop and meets the moved boundary there, so both directories stay protected. The mount holds a reference on the covered vnode, and the doomed check fails the lookup if it is reclaimed anyway. Approved by: so Security: FreeBSD-SA-26:81.vfs Fixes: 2f60984053e5 ("namei dotdot tracker: take mnt_renamelock shared to prevent parallel renames") Sponsored by: The FreeBSD Foundation --- sys/kern/vfs_lookup.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index f6ed8cb80fe0..985dbf467c11 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -266,11 +266,12 @@ nameicap_cleanup(struct nameidata *ndp, int error) /* * For dotdot lookups in capability mode, disallow walking over the - * directory no_rbeneath_dpp that was used as the starting point of - * the lookup. Since we take the mnt_renamelocks of all mounts we - * ever walked over during lookup, parallel renames are disabled. - * This prevents the situation where we circumvent walk over - * ni_rbeneath_dpp following dotdots. + * directory ni_rbeneath_dpp that was used as the starting point of + * the lookup, or over the directory it covers, see + * nameicap_union_fallthrough(). Since we take the mnt_renamelocks + * of all mounts we ever walked over during lookup, parallel renames + * are disabled. This prevents the situation where we circumvent + * walk over ni_rbeneath_dpp following dotdots. * * Also allow to force failure of dotdot lookups for non-local * filesystems, where external agents might assist local lookups to @@ -303,6 +304,29 @@ violation: return (ENOTCAPABLE); } +/* + * A name not found in the root of a union mount is looked up in the + * covered directory, which is the same directory in the union view. + * If the union root is ni_rbeneath_dpp, move ni_rbeneath_dpp to the + * covered vnode. A relative symlink found in the covered directory + * is resolved from the covered vnode without crossing back into the + * union root, so dotdot from it must be refused as from the starting + * directory. Dotdot from the union root steps over mnt_vnodecovered + * in the vfs_lookup() dotdot loop and meets the moved ni_rbeneath_dpp + * there. The mount holds a reference on the covered vnode until it + * is unmounted. + */ +static void +nameicap_union_fallthrough(struct nameidata *ndp, struct vnode *rootvp, + struct vnode *coveredvp) +{ + if (ndp->ni_rbeneath_dpp != rootvp) + return; + vholdnz(coveredvp); + ndp->ni_rbeneath_dpp = coveredvp; + vdrop(rootvp); +} + static void namei_cleanup_cnp(struct componentname *cnp) { @@ -1361,7 +1385,8 @@ unionlookup: (dp->v_mount->mnt_flag & MNT_UNION)) { tdp = dp; dp = dp->v_mount->mnt_vnodecovered; - VREF(dp); + vref(dp); + nameicap_union_fallthrough(ndp, tdp, dp); vput(tdp); vn_lock(dp, enforce_lkflags(dp->v_mount, cnp->cn_lkflags |