From nobody Tue Nov 17 17:01:45 2026 X-Original-To: dev-commits-src-main@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 4jTWGx4xfmz71QSX for ; Tue, 17 Nov 2026 17:01:45 +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 4jTWGx3pvpz3PnL for ; Tue, 17 Nov 2026 17:01:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794934905; 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=50B16BWZZ4toeoBVaKv4xhpe7u2aoxtXa3KHyKQG51s=; b=QrzSS01xADA3VQvfBNJkfaaNeFOvsOXjqoR+xVDrXLnqZQbcxjGXNJsK1D0PYkcOn8Apj2 2TzCGRnJQBy0S7lwhn+urmq2qPYF3EKHinzYBIXSojMu8upepRyBpME/hSShgyhv6f+GAC VGMuigHMELdMy7Ta3lk5+TPl6pybqCNuI9AcWsmCVwSuwPmUn8Pb5r2p6LH0mjnMgj8TQH NMl0Cz0k0xC+o8yqomwPAhSmUsFumrCGZMNH+eMj7xfIVbBW8qZQuxNdbG6CKuYctFxFPw k3tdEzI1hAFKg7WOURG+JmZ0P0yiAWZ9snQna/hs4jryF7/ymin+WmuGj+AlTQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794934905; b=NNmvf3HV9emxhdiiEtLYnHDtYmcGU/3J1RS5VBDdo8HwHXWRsm7fdfKplSIMI/FLksP0eA 2Bw+ebqQ2AMzDzVtAfb7KqQXYcXGPorUWPHUO9Y7ATr/UnlkHdsnGpBOvTwh5660YhzkmF yz4LAqHHAsScBX/hjY7p2U1oO/vwZxofaBEonHdIdw/fPbFac6mKO2O+Q73Tcr3UsBP4QW 79cX+YEIWg/MfHK3ZsF91pDJdnpHmE9WRoR4bHTUmmXvfLxZrOVUy/jfkpq72HWR+ny17g q9sw6+eSLJW1Z/TTYTJ2yob1rDm2KEEWWd6vM0hU5FmyWU9Xm0GsHbA0GsJTBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794934905; 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=50B16BWZZ4toeoBVaKv4xhpe7u2aoxtXa3KHyKQG51s=; b=OU9m1xwIZUENRnj9rAlCAndpQ3QNoh/FW/G2yjUvhYXv1RCN2pDKbBUyZzcpPeVbauBaco X0i1xhVWqopEcZ4noEx+ULDeeYBvbPuEo3XspMMBYuJaE83xaIrmO+uXrauPG2bow0UKr4 Zahk68LUZ6EYOfEuu6AuJJGDcWr/zAFmVrTtXwtByw5V33vlUbeYGXAjQBei5rT9e2pLkM yWQk4hg1NWAskCWP2y3D1tm1G8DWHhPXUA2Bf039JH6vauV3NKL0Ruavz/SlrRqaLLKbAM dSPEe8PpdD7amRL8iZoxsjbyuYb1QoPJr/kAap6bwIRVaJMtt3GokC/ixnrBmw== 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 4jTWGx3TjpzqqC for ; Tue, 17 Nov 2026 17:01:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e0b9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:01:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Konstantin Belousov From: Mark Johnston Subject: git: 8be4485c561f - main - rbeneath lookup: move the boundary on union mount fallthrough List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org List-Id: Commit messages for the main branch 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/main X-Git-Reftype: branch X-Git-Commit: 8be4485c561f2054177d2af871d27c19efeb8dc2 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:01:45 +0000 Message-Id: <6afc8879.1e0b9.ba4ecb9@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8be4485c561f2054177d2af871d27c19efeb8dc2 commit 8be4485c561f2054177d2af871d27c19efeb8dc2 Author: Konstantin Belousov AuthorDate: 2026-11-12 20:00:17 +0000 Commit: Mark Johnston CommitDate: 2026-11-17 16:57:00 +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 | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 6a7d76154d5e..114845a1d295 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -269,11 +269,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 @@ -306,6 +307,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) { @@ -1504,6 +1528,7 @@ unionlookup: tdp = dp; dp = dp->v_mount->mnt_vnodecovered; vref(dp); + nameicap_union_fallthrough(ndp, tdp, dp); vput(tdp); vn_lock(dp, enforce_lkflags(dp->v_mount, cnp->cn_lkflags |