From nobody Mon Nov 23 00:16:02 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 4jXmgk6w1zz71K8r for ; Mon, 23 Nov 2026 00:16:02 +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 4jXmgk3fy1z4Lgn for ; Mon, 23 Nov 2026 00:16:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795392962; 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=9GIthTn+WleYQkhC1YLlI44Xubz0RnwyU/bTddBEVk4=; b=r1Ufmng5zdd000GD0XvkLumsGYulvlW7niRhaGQ2DcBFVMRDNh02duNJLV9IHWGN/tS+PH F9kWMOqxBEDHY4D0zGop/JyQ1WUpAX1VpDdsuIPyTHGZOZfWGa0Kw5lyQxxLj1kNa4zbwz w28JXvoKZY4gBsgo8tquUBs8rqa7dlAe7l8GNRE/eB8Q8sxx+bMS9N12euwBg9u2caw+Ae wzNWOqz8nhePe3AvfC2PckKcL3dLl58MZ6MMqZMT2/6+CAOk6+IUvv9VlgxYXtB1K6RB2P Fr13pJCDGb9U1+0tCjIdPYHZOr4R9Io0gA40iOYz+IfPNS6bJmX6szjTbg8H/w== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795392962; b=wz3y+hkoaCyQw6ttZT4CO7aSI9snn89rvk3WISkUj6IpsqkAIXSO2HF3Q7YeMqtSERqbZl +i67OukpC5XmbGNSBJDk446grxhdVpoObnlqRZORy6j69/ZHyYROt5JjJLej29BfSIV2kj TEDa8LNDciEXeDJXimyowOC/k8gwEbuqFRWpyMk+6IwVh+u1O7CSH3nwBoCOoAEqWtWFr2 b6xbes4xESWwyGWiPiAGANLy64qt3w+oRuiLtJR81HNUfQu6rBbpxr58r1xjryMfTZyeOs z8dtPz+zgiLKtih0H+yWVmU4go242yzEWK5B5jQOmU566PZQluEz0Rzt66tUJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795392962; 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=9GIthTn+WleYQkhC1YLlI44Xubz0RnwyU/bTddBEVk4=; b=c/ey03Ylpr+2qH6YGeacuZ4wmqaiyIZc39aLUxLFyQNyrhpvQx6uZgmz3a/L87cr2K3HQL Mb/mSkvbmosUtULdhXnHnoiYBLK5ku283jhpAeUm2CIS4FD+kfDkgdp6AofCQpgFZljLgA lNy5ijPIB0KOWdG6Bnaej9r8ia/qoFEptrKimKYJxytLZGEboCqrRg7Ehf5hp5LQdIdkoJ 8Ulfa2t/AOPm9ZnKwdIrJ8+CCGJaub/pNMdVBtMC9+2oNGMM/EZufKV45VpZ92yGwLP2xA zfnlPcL7q97fohp4NiUyAua3YV/+zNLwXvT5b18gfoGJMGZH5tBpm9/rDacmLw== 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 4jXmgk3KZtzR9V for ; Mon, 23 Nov 2026 00:16:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1be5a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 23 Nov 2026 00:16:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 77552467648a - main - execve(): unshare pwd 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: 77552467648aa06b8c9ac95fb45099630c2a769b Auto-Submitted: auto-generated Date: Mon, 23 Nov 2026 00:16:02 +0000 Message-Id: <6b0385c2.1be5a.46ead8d6@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=77552467648aa06b8c9ac95fb45099630c2a769b commit 77552467648aa06b8c9ac95fb45099630c2a769b Author: Konstantin Belousov AuthorDate: 2026-11-21 04:02:31 +0000 Commit: Konstantin Belousov CommitDate: 2026-11-23 00:10:23 +0000 execve(): unshare pwd Ensure that pwd is not shared when execing into any ABI, so rforked siblings are not affected. The altroot changes made during exec, by linux_on_exec() and by the setuid altroot clear, affected rforked siblings sharing the pwd. Remove now always no-op pdunshare() call next to fdunshare(). Reviewed by: markj Fixes: fd745e1db6b5 ("linux(4): Use pwd_altroot() to tell namei() about ABI root path") Fixes: 2137bad49a6f ("exec_new_vmspace(): drop altroot for native processes if setuid") Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D61858 --- sys/kern/kern_exec.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index df6f04dfecbe..d081ce5dd879 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -858,11 +858,11 @@ interpret: } /* - * For security and other reasons, the file descriptor table cannot be - * shared after an exec. + * For security and other reasons, the file descriptor table + * cannot be shared after an exec. pwd should not be shared + * either, this was handled earlier in exec_new_vmspace(). */ fdunshare(td); - pdunshare(td); /* close files on exec */ fdcloseexec(td); @@ -1265,6 +1265,13 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) imgp->vmspace_destroyed = true; imgp->sysent = sv; + /* + * Prevent an rforked process, possibly sharing pwd with + * us, from being affected by altroot. Exec is already past + * the point of no return. + */ + pdunshare(td); + /* * Drop altroot if setuid. It is done so late to avoid * clearing altroot until there is no way for execve(2) to