From nobody Tue Nov 17 17:08:13 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 4jTWQQ0kw0z71SCj for ; Tue, 17 Nov 2026 17:08:14 +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 4jTWQP55B7z4MvV for ; Tue, 17 Nov 2026 17:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935293; 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=u8SHv9bnRrcfkbnDUO3YwOKprhE+MWwmGjlNewqYNl0=; b=q8uDlqlDDR5kRJLAIgQX1Ps/g/xtN2MdHRFbkbQqxFZ5C/zYWGDNnPlvhZipUXCaFQNQZ5 jfZ2RV6R5YBhXGzbMunony0LdjFJAVGFSsv+LMcE4UoP61w4QwbliAb6yTDSQSMQWtAEnF eD3xkZErWv/VLqhd4TyCjN74L4yRr66E/HNIv1ydXHKxItySg8I2AkDAdPZGXWGiaWLLjd 7x/K2MwPrWN+ScQDyxhiVuA8heaiWNMsw/M2RcbSTzje8bpS7fdn6ccm5pzFzNJjbrTH/F ptnnUNfDTREOjKykPQXhbysC4na8NjudF1c1kz5RL7ynvYcb6t5Jp3dioASIAQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794935293; b=Zq/RFyfymOSXiJv00U7Ns9Qo5bXv/uShoKQMwKqHQAHSqJGrlx+czExJ5tb8PwYHOtlRcO NdMiRcSXfT0O05ToIL8hHX7CDGRuKa+ZLiLNYiVoCxOkkGWBowKaPQe0+JFzneTdD4pVwb 4mRvH+8XEPB4mgV2V9DGVwnvT3yEZ1GUZaXET/y2++9JRYc/qJs7o99r6N+fWbCNZ8vqr/ P8VFf3bzAeHt8OQeasy7YPjSxM31nCS/rBxOM/bZTtNPLjAbksyqvjJOaaV8VxpxrNKAGb dfuMWdVjzOQIPL4j2+w/qCdPsev0sBZSmWcxU0gQzcYeNCahoQALTtNJb7EgDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935293; 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=u8SHv9bnRrcfkbnDUO3YwOKprhE+MWwmGjlNewqYNl0=; b=U7/iHXKQxX0ZWjEly27py2JIfHxDZhiZ9GNxFRPEOKe0Pdp070+SKeu53kWcBxwaQsubQl mqP3UHWIXmrP+dKxtFnjARygBkruy4bpMhq4RUt2wJOtO0MIvPMmM7oWtEr0bLzGjUKlnk EG68p4dMT4EEvDIOkb3rVwAnuIDgM5MjdUpiJ97kHdwMSY/bitQnVq/dZLPcoKcB6/8uRO ivFV/ND7f9PQHfQvfqmNsqdqDWwi3kvrud9fQ+2/lYZQiO8DNA0TwyLqph8tXsrrEmfxAM uONpc97VA8juSSHZw8/kzhs5JaDmMyiSS6kZGo2iigx5BTYszIMTj+30cX30KA== 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 4jTWQP4lQpzrq2 for ; Tue, 17 Nov 2026 17:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e348 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:08:13 +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: 680a216eaf78 - releng/15.1 - rbeneath lookup: do not allow to step up with dotdot lookup over VV_ROOT 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: 680a216eaf78d2085f2663f74145d942bbdcae78 Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:08:13 +0000 Message-Id: <6afc89fd.1e348.3c4101fe@gitrepo.freebsd.org> The branch releng/15.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=680a216eaf78d2085f2663f74145d942bbdcae78 commit 680a216eaf78d2085f2663f74145d942bbdcae78 Author: Konstantin Belousov AuthorDate: 2026-10-23 03:48:47 +0000 Commit: Mark Johnston CommitDate: 2026-11-16 21:21:09 +0000 rbeneath lookup: do not allow to step up with dotdot lookup over VV_ROOT In vfs_lookup(), the ".." loop steps from a mount root to its mnt_vnodecovered vnode before the name is looked up. nameicap_check_dotdot() runs only after VOP_LOOKUP() and compares the directory being left, ni_dvp, with ni_rbeneath_dpp, the start. After the mount crossing ni_dvp is the covered vnode, not the start, so the comparison never matches and ".." is allowed. [*] Before 2f60984053 the loop called nameicap_check_dotdot(ndp, dp) right after the mnt_vnodecovered step, and the covered vnode, which was not among the vnodes the lookup had visited, was refused. The change replaced the visited-vnode tracking with the comparison against ni_rbeneath_dpp, and removed that call. A process restricted to a directory descriptor by Capsicum (capability mode, or a descriptor limited with cap_rights_limit()), or a program that relies on O_RESOLVE_BENEATH / AT_RESOLVE_BENEATH to keep a lookup beneath a directory, is not contained when that directory is a mount root (for example a tmpfs, nullfs or devfs mount handed to a sandbox). Through ".." it can name anything reachable from the directory that holds the mount point, within the descriptor's rights and the usual permission checks. Sandboxes that are handed a mount root (a per-sandbox tmpfs is a common pattern) lose their file-system boundary. Similarly, if the ni_rbeneath_dpp is reclaimed and then re-instantiated, e.g. for nocache nullfs or just by vnlru, the startdir might be bypassed because the comparison would not hold. Check for doomed state to close the possibility. Approved by: so Security: FreeBSD-SA-26:81.vfs Security: CVE-2026-101312 Reported by: pjd [*] Fixes: 2f60984053e5 ("namei dotdot tracker: take mnt_renamelock shared to prevent parallel renames") Sponsored by: The FreeBSD Foundation --- sys/kern/vfs_lookup.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index f5dc2322c86a..f6ed8cb80fe0 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -931,6 +931,18 @@ vfs_lookup_isroot(struct nameidata *ndp, struct vnode *dvp) dvp == rootvnode); } +static bool +vfs_lookup_invalid_boundary(struct nameidata *ndp, struct vnode *dvp) +{ + struct vnode *ndpp; + + ndpp = ndp->ni_rbeneath_dpp; + /* The doomed check prevents escape through the startdir reclaim. */ + if (dvp == ndpp || (ndpp != NULL && VN_IS_DOOMED(ndpp))) + return (true); + return (vfs_lookup_isroot(ndp, dvp)); +} + /* * FAILIFEXISTS handling. * @@ -1276,7 +1288,7 @@ dirloop: for (;;) { bool isroot; - isroot = vfs_lookup_isroot(ndp, dp); + isroot = vfs_lookup_invalid_boundary(ndp, dp); if (__predict_false(isroot && (ndp->ni_lcf & (NI_LCF_STRICTREL | NI_LCF_STRICTREL_KTR)) != 0)) { if ((ndp->ni_lcf & NI_LCF_STRICTREL_KTR) != 0)