From nobody Tue Nov 17 17:09:38 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 4jTWS30xzVz71Sgs for ; Tue, 17 Nov 2026 17:09:39 +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 4jTWS23kt5z4QGK for ; Tue, 17 Nov 2026 17:09:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935378; 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=uv/gUo4qsCGZmyVzHBOTvGQtgYX71oK2t1P7VLcOHkM=; b=mbCGw6/2UUubW8B0jKvxscdzthNDxuPIxOZWlXwOwPgwyLJNyxxD7ur/jXyn5NOY+c+nDF g5PxLEOuHzMvznISp+ej/nmYqRhKVFVZ1k92gdoRRORay6M7xm1229qW2qkJqJ3irfRhd+ C1GoG2caF66pdZrdyufp2DRt5ziOZG5wJiPtVA3EtlzAFuZ4BQc9Ip7O6iosOw+9T9u9SG 2s6zMoIvGYACxWsFexGL5dJqB54S7xHHx0WyExm1mQ5uBzIX2/OEg0w25RwtzZdnaAkfVU YtU2/NT49qbKK/BYblchtgS6omFXXbWHxv6Quvy5S8nHJLWp69zOwKHbU+YeZA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794935378; b=xdsStU9kxFTeBaGgGU6Uc42DBhsp9RqVSPoHNYKE2B9/CmiXg2lGTWgTwLr0oHONkIgtok U/Gqv9FDvisRnMREZdXE390poyhNUSZW2s6FE/ikJE4sqBFYGsGUoR0UW09JEfuI8duqRx 2goJQD5/T9//53kRgaWqWJ/8KdB8rladVpbkQ1tBYpVcPfQ19J5yliuu0MuDzWNPLP5Gjm 69uUu6COlSuOW+Ce5YGqkjX8YNoe1WT61UzOQiv0JyZO0es5CXgD0/T4jB091OCYqWbQlS 8Hp0JFg4p5CnuZ1weuAzILrT8dgu7MUgTtrVO4zBLgGqR1XWa2n1QLci8Nj51w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794935378; 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=uv/gUo4qsCGZmyVzHBOTvGQtgYX71oK2t1P7VLcOHkM=; b=JD8zX99yZoMM1HukMSfG51hNhrPkfoLgFAb6aqwsFHz3SV7s2jn6CV/QoGrxqoT3dXTnEc vCcJymNmvzdS72MG0zx3MKSkauCDIEyiRgVcSMTof/swsSsTfcUEWCTdxM0fTlp8/cC+13 oaKMtMcgwF6t7YRiLqDgX1Sxkym3ulM64I/bv/WipURk5dyekXjJ43s8pk6O8ziZTd/s97 mjirhYxNRNMmFEmh5V3YSK9fvCDYquDfPBaiM51zFki7ZDQQfa6sb5DohMcU5luh/aYRZJ 3yPIWuGiVX8kZM11ZO/4AEKTiMeH+02UK3Lb+S3ql35I1yi6wESa9X3FK4zw2Q== 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 4jTWS235hhzrkW for ; Tue, 17 Nov 2026 17:09:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1f72a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 17:09:38 +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: 48caab76e520 - releng/15.2 - 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.2 X-Git-Reftype: branch X-Git-Commit: 48caab76e52002a88e2fc8a244f1eeda3a9c419f Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 17:09:38 +0000 Message-Id: <6afc8a52.1f72a.7a8f89ac@gitrepo.freebsd.org> The branch releng/15.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=48caab76e52002a88e2fc8a244f1eeda3a9c419f commit 48caab76e52002a88e2fc8a244f1eeda3a9c419f Author: Konstantin Belousov AuthorDate: 2026-10-23 03:48:47 +0000 Commit: Mark Johnston CommitDate: 2026-11-17 13:34:51 +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: re (cperciva) 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 0a6e85d4f2ee..4ddf7d5433bf 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. * @@ -1280,7 +1292,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)