From nobody Tue Nov 17 17:05:57 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 4jTWMn622hz71Rwf for ; Tue, 17 Nov 2026 17:05:57 +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 4jTWMn39PPz4JBR for ; Tue, 17 Nov 2026 17:05:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935157; 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=JFlx8UA7OuycTy5vTnxTuMMw9dg6k53zazEYMPsoQjQ=; b=RwdxrwFuMqka7ySBfBL5756KBH9EWVG6RQ9+LbMmWUmpdd/8zXGSKlr5qo8s0r+BOhb5yr 4MdwSmMBU6ua/ykFTmpNx0ITvSobsQYp8O055qb1kRAZGBOBur5n3cUskZGy2s9QBHe7UC YPG4/ZlP6XNlJtkmPvdrW4ajpf/gl7rsG8UhWHttQP1dXLK/71iiwe1HUK3g5bvXuQeFTh qhWBptydoUcYm7cwZ8zMIX3TkbNoxmbGRiQamuf+TBh2XLvtEbFvakKNNDzFpXsDRqRXvV FBPAho8Db4qO6uzBoFYGe6GWdMGODZxIEeR3sE34gBcn2mLGjt+NoFKVaf48KA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794935157; b=EOXiwfe3ZQrFP8MPD52Osw2azSsy1vUx92pMSBwCVF75JG5L0+Tx+/iaPdT/pQ+L342wel gDeK9kKzpOigQFO2jwV1f4Grt5iFkgQohBKUJagzVESBjHDGT2+NgYVNKCzgG6dDJ7S1sr 0ZdTqtgUV23IdJHC+ASo3QSGq+1QV3+nnJuOm8Y0ZeiEs6PAQdrGShV/pLUAw8LgmzIu43 /GnDS7G12kxwD0dLrK5pwWcGP2+iIiLfx18+H1z5kE5d5s5UytqfQWR76zYP9GUiKaY1oz 1GtA4MArfKkgfSZVFClR7BPEvTpEeMF2dsnAEkizaOxXXXfhmCvz/WEL+9K+Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935157; 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=JFlx8UA7OuycTy5vTnxTuMMw9dg6k53zazEYMPsoQjQ=; b=ZdphxafVEXPIFfn8DSlq/5vT6BlLvQZ2GBn5RN7Qqfr1Fh8Tibc54/xFQd6YA+O6K1YDyJ mBnbthXn05tNt0629Rw5kg0YOUv+G9H2OujWdwxTV5fe1nRLLh8KskbyDLaagCFZgMr9Y8 FqhPMrLNAjffHI6nRpjPpbHUNFmvKxvjOoV3l2jH3zNfZ4ZBBBGEWuCdazMSBEFFOZ35J+ IZuVzy9IpaHGTYspwsOllNPqMiYHE3RcYgNkzW7IkRz1lSxM58AoOp61yBAPEOUrHsDQzH +EW8g6OvbCCTZ2BxofcXXRndfYr4gup16ZHfc/V7fpFyZ7bimvxB5K7pLZABjw== 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 4jTWMn2r6lzrjm for ; Tue, 17 Nov 2026 17:05:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1fd01 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:05:57 +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: 956d9507e9c0 - stable/15 - 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 956d9507e9c09f297be04cdbb18fb66e8aa52cba Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:05:57 +0000 Message-Id: <6afc8975.1fd01.fa68955@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=956d9507e9c09f297be04cdbb18fb66e8aa52cba commit 956d9507e9c09f297be04cdbb18fb66e8aa52cba Author: Konstantin Belousov AuthorDate: 2026-10-23 03:48:47 +0000 Commit: Mark Johnston CommitDate: 2026-11-17 16:57:22 +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 b1a39bf54bdb..768b0e47f673 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1068,6 +1068,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. * @@ -1417,7 +1429,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)