From nobody Fri Nov 20 15:10:49 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 4jWJgZ1N6bz71yKJ for ; Fri, 20 Nov 2026 15:10:50 +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 4jWJgY6Mxdz4hy9 for ; Fri, 20 Nov 2026 15:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795187449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oVYapTAolccZGSbhsAPkw90Jpqj5mFodpJpi6VrC70E=; b=snKNfWUe5hJfkff2PdAgFk6M5MxM/zJLgDlCgkVZJ2Hyrkb4uOECK8t+mDxMMa13Go9W6p t5WI1AuqOUxalwjIhZUt9hj+P1whw1z+nJu4GbvW/pdJ75yrZ4XoPJOyB8rH+0k0pxwQQU n4mbwWNmm4RxcNEU/HYrgO1UFHahLWU/9yIk2zh5ftpg+nblu4r2DtQnIkbDfZM7Sd0B+f O5wo8OQAw3T5MditrsSgr47gLQ+PpYqL5EHUCbGdS/P4PRYqGAKmmJdkBJnwVOxY7wCIMA IkxlJNx2n/OHE2nOs7yKRa6WZu5XrLGui8MxYu/mYl/ANX7x3YAqP82kKwY/pw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795187449; b=lQBCSvSlox4ziuW6CSeK4EtKXbfs1fuJSxzn8UQQQu1b+JHQkcEXRvrYkPqRLzrhnAyQ3F 0lydllxqCW38O4l+ousUGwZzxOVqljkuqcXTliLfrzl80BR+N0evdBlW5LgODSNQPTpJRF plPl8nW3/44gsmxp9/FtmXMladAe03HskPOgxXRLpZR++/wLcKvYJB+u0U2ESe3dkF0C+9 +Tb3EEQOVUoIkNTqUgUTcNdcESijMX/0To6sMXujTcXWXyd7G5VHnPhjvaYIcUogoCIVJm E8fpxU6/gkiCGizYgq5PlRXwJjfSWQGa9CeBTT0rIJVtz8l7UqP28z3qqwl5tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795187449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oVYapTAolccZGSbhsAPkw90Jpqj5mFodpJpi6VrC70E=; b=wPq8JP0cqWqnrvbV9blxqyfVrIZVgtH5BL6Q+8BRo2Yuvv0cZ0gF5+wmE+pw1bg0i5qqQk 8t9tegBUfnfRcRMNlX3cm0/Vn6FPBmzC+e3yN35nyLr2V3yIYn/Kb4Q/OAHiUwi07ETsn7 gXG6BWcvYcNy7U3odEANJXiJgE3qD6nQqjYkRlJ3zSmKADRtmLzGxSxp6R25gq6fj9+bmx Zl+/oF1v97CNA7xe3eUcHxHgh/yy4BZn7YYrGGocjCEF507eKDzPFxbj3bS3ZcYHk7ZYFh x/UvBbb6XYcU4d/wiVtJazlpnfxMXRlIv6dz5XkJsl9IyOoQCz9hHWT4+2WXzw== 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 4jWJgY5yYdztMl for ; Fri, 20 Nov 2026 15:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1863a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 20 Nov 2026 15:10:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 151a23fa79b2 - main - namei: disallow altroot for beneath lookups 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 151a23fa79b2a6047e60f65edf77e1634308a1fa Auto-Submitted: auto-generated Date: Fri, 20 Nov 2026 15:10:49 +0000 Message-Id: <6b0062f9.1863a.691741f7@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=151a23fa79b2a6047e60f65edf77e1634308a1fa commit 151a23fa79b2a6047e60f65edf77e1634308a1fa Author: Konstantin Belousov AuthorDate: 2026-10-21 21:39:02 +0000 Commit: Konstantin Belousov CommitDate: 2026-11-20 15:10:26 +0000 namei: disallow altroot for beneath lookups Once namei_setup() has determined that the lookup is strictly relative, set ni_rootdir to pwd_rdir and mark the lookup as already restarted, which effectively disables restart on ENOENT. This is done in namei_setup() and not in NDINIT(), because RBENEATH might be set after NDINIT() by vn_open_cred() or inherited from the dirfd in fgetvp_lookup(), and ISRESTARTED is cleared by NDREINIT()/NDRESET(). Noted by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D60035 --- sys/kern/vfs_lookup.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 114845a1d295..2efdbe3b4f11 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -453,6 +453,13 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) if (error == 0 && (ndp->ni_lcf & NI_LCF_STRICTREL) != 0) { ndp->ni_rbeneath_dpp = *dpp; vholdnz(*dpp); + + /* + * Prevent use of the alternative root and restarting + * the lookup on ENOENT. + */ + cnp->cn_flags |= ISRESTARTED; + ndp->ni_rootdir = pwd->pwd_rdir; } /*