From nobody Thu Aug 6 09:00:23 2026 X-Original-To: dev-commits-src-branches@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 4hG1T34NBVz6mg22 for ; Thu, 06 Aug 2026 09:00:23 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hG1T33DS2z3VjR for ; Thu, 06 Aug 2026 09:00:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786006823; 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=VPRSQW8aGlXJcaLMyzc912sgglbcftiLNDxRUHbw4rw=; b=xRqtKZFirCnB4K2mrmpKZVM9B9Jqt4DIam1ShhKncGBPkntoBdp7xFjKhFOfJ5UQ0sM3QO Pipu6SpvcVw27Vs2mTRD1ofcivpeyzYpPBEeHhIqw9eWvPnp1OcEqObHuOioP2RxAFty2S +G3rI4h9BECuIzSiaUnNmFGiSmqTFngzCfeZmr5/sZc6KjrMDQfK5Gj84qYZPFzT5d/UQ4 0YCkA0tOZ9VoP9P5G/j0EYvvWwdvIA1O/BHNdLnj3MKC4BNeF8ceh4dHVcVIlG1dgEIFHH g+tp1/lfclwQyp9hZ7g/rSKAk3IEptameHDBDORm6X7FlBDPGeab0VnGaYVjNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786006823; a=rsa-sha256; cv=none; b=R0nl2jhaZg8sm0ZIG2cauuu5/xv9NHA7FEEeIpjgblxVAeASOv4LuniBORrQ+0f8l7OABe G/oRZ9UtOYvwjF69TgiiEVRi7ADfQFvgnvt8uQSkESQe7G8Pw7aBBsd1FOykPJL+fybyXL AUCNvx29WnlMAz9jOhPI+gzj1d+ddBRpgyM6wYPFKgppKI3rXMaHIH2fb6P2gXJavLoEhe n5ncuRyvlRFvNAzn9+Xn5eaZ9dvysz1Pt9dw4ZVe09CpzSYGUOSkHchnaSLI0yXtnpt/xz GlVp1ors9PtbUTwH6NjmEwXrwkWzD0d134aHq0UIM5HuxAwT0iR2aHjY+0YYWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786006823; 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=VPRSQW8aGlXJcaLMyzc912sgglbcftiLNDxRUHbw4rw=; b=NrI0QCg24p1GjgFMV2f4BUjVbHiCe/jBv9R2qEigO/44AURNxgSVnmCurJYskCobhweB1X MxHNj7ypR4s/bcFzglCy6/S+9ikpfS9ChFA1QGV1pw7qxPV9MHqv0R392rik6H022h3hTv WMX9gyD9VOUu9dG5RwvXfw13a6vbUILbkksGDxTT/tlTfpayI/gjkq6rpyDn5QK9Ds666x pxuMril5o7o9gqVnHaP05pNEfqW7kH7sXchAgvgthJcwNhmAvmSBeiGAItBM7t+XhWlbpY twuZHaeEH333j9JNK9/ubz2aDHB+ZSu2wFw90XsWrSQX6EsuMY7YFBn+cvTLiQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hG1T31Tg5z1CqG for ; Thu, 06 Aug 2026 09:00:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fe3c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 06 Aug 2026 09:00:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1f3b673d17c8 - stable/15 - kern_execve(): avoid storing non-VDIR into p_textdvp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 1f3b673d17c81711fcf28ce2ed3354a0dde1fd05 Auto-Submitted: auto-generated Date: Thu, 06 Aug 2026 09:00:23 +0000 Message-Id: <6a744d27.3fe3c.7c2e1fc4@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1f3b673d17c81711fcf28ce2ed3354a0dde1fd05 commit 1f3b673d17c81711fcf28ce2ed3354a0dde1fd05 Author: Konstantin Belousov AuthorDate: 2026-07-27 16:58:31 +0000 Commit: Konstantin Belousov CommitDate: 2026-08-06 08:59:45 +0000 kern_execve(): avoid storing non-VDIR into p_textdvp (cherry picked from commit 930f2e4da96487f18a82f912275c6302c39b9bd2) --- sys/kern/kern_exec.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 9dedd60ce4fa..5f7adae8df03 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -32,12 +32,12 @@ #include "opt_ktrace.h" #include "opt_vm.h" -#include #include #include #include #include #include +#include #include #include #include @@ -568,12 +568,46 @@ interpret: newbinname[nd.ni_cnd.cn_namelen] = '\0'; imgp->vp = newtextvp; + if (atomic_load_8(&newtextdvp->v_type) != VDIR) { + struct vnode *dvp1; + char *buf1; + size_t buf1len; + + /* + * The newtextdvp vnode might be not a + * directory when reclaimed or when the image + * is mounted over a regular file. In the + * latter case, try to resolve the containing + * directory. + * + * In any case, p_textdvp must be either a + * directory or reclaimed. + */ + VOP_UNLOCK(imgp->vp); + dvp1 = newtextdvp; + buf1len = MAXNAMLEN + 1; + buf1 = malloc(buf1len, M_TEMP, M_WAITOK); + error = vn_vptocnp(&dvp1, buf1, &buf1len); + if (error == 0) { + if (atomic_load_8(&dvp1->v_type) == VDIR) { + newtextdvp = dvp1; + } else { + vrele(dvp1); + newtextdvp = NULL; + } + } else { + newtextdvp = NULL; + } + free(buf1, M_TEMP); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + } + /* * Do the best to calculate the full path to the image file. */ if (args->fname[0] == '/') { imgp->execpath = args->fname; - } else { + } else if (newtextdvp != NULL) { VOP_UNLOCK(imgp->vp); freepath_size = MAXPATHLEN; if (vn_fullpath_hardlink(newtextvp, newtextdvp,