From nobody Fri Oct 09 00:20:50 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 4j16w318YLz6Z2GM for ; Fri, 09 Oct 2026 00:20:51 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j16w26gS2z4M99 for ; Fri, 09 Oct 2026 00:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791505250; 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=cK1Ew2zCALL6NXTnYNXhAIR7yWwKye1Qe27W0TNmPSA=; b=G8bSCLpncCniK8IJr6SW29EZcnkYl+326jaH/2QQGDt5a3zEajoUO1amLcoXVzUK8VhLzO mwLWTNfVIwyZuGb+qfZpXntp4xnwl+yx/SRKqFd+bSwpHc+2yFLxoReAAreEx7LNrlnKA5 pIAxQ5B4JVecJxF9qq5mfp7juODVLaDmXVD4EbYtfc6e+CkRaG8nQwHhZMcQxSg4rGm7id LPMLDvE4MPkWxMiJnuRWO3WkPykXIx9a6tVB5ni/me7UBGzvH++t8/zb9oA5pbY1Ai16+G dH9JMbe5gMkXvS2FcCNok4RJAno9ipBqdS567c5XEj2ltTO29zUndGyy+OasLA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791505250; b=v4dRUuu3CgRFQIR77v6Cy6OXaXBQLCbRbumxjVn1shNJ+8/iDyNZ4STiMsjN6IMiyOfDfK EKQauD5YjX2P7y+eZ253tuj3We9rDEgnxTnD7pFwTSZFTE6cWSfCbe5OhToqh31UfIkUfV rcFRXvSig5geiAcW4dXyryehaHdgPfTWnErrSVq6L8vHlffpEmyo60ZJAMcP02YBCE1vrd X+O/MVsq1Fz4ObV/UDIjSbXZHRXfqZTaXQ9BXtXuPsvmDNhR25b4KKUfaFV4PWVmnPlkKZ UJTJvKNgMZ+UeQfc0ZXz6hpYeMb4hBlvrV3ipildGfivE5AIk7iEZ26a6i9JOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791505250; 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=cK1Ew2zCALL6NXTnYNXhAIR7yWwKye1Qe27W0TNmPSA=; b=h9ZWkrV2LKUoMFdxUxcX4yVeS6sF04xfzam0fVa25ZUzFjuUz5yQyC1VLfG7JMtUtp2j0y Qr4kEPurFqAhSCmVDAt1c4TkMSn1nZUyh84T5qnBPHEXUoMbnvbV2PTg8MqFBz6Z5Hd44R vO9IJeiXdf03ylZn+kj/IiFd3PSr9zDwbH1Ez7xyn2TIXWd231VL9hn6pAPtFkOAY/6ysG mR5GiSLljLKsUiJnjaJ9qsZ2RctzOaP8PohQ6V4IHwerZWCcc/Y8l+KxUUpi89LUWSAzlm mW4F0I04RprN0UdDJ+PozvlWWGsR8G2mgvLTg2ZE8neOGkQodKcTxuHiP19Caw== 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 4j16w258bnz137P for ; Fri, 09 Oct 2026 00:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1936c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 09 Oct 2026 00:20:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a337053ca5dd - stable/14 - stand: Reject ELF files with PT_LOAD segments where filesz > memsz 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a337053ca5ddcea570f0aebd0b17680b50cc96db Auto-Submitted: auto-generated Date: Fri, 09 Oct 2026 00:20:50 +0000 Message-Id: <6ac83362.1936c.9f66125@gitrepo.freebsd.org> The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a337053ca5ddcea570f0aebd0b17680b50cc96db commit a337053ca5ddcea570f0aebd0b17680b50cc96db Author: John Baldwin AuthorDate: 2026-07-31 17:52:56 +0000 Commit: John Baldwin CommitDate: 2026-10-08 18:47:52 +0000 stand: Reject ELF files with PT_LOAD segments where filesz > memsz Reviewed by: jrtc27, kib Differential Revision: https://reviews.freebsd.org/D58543 (cherry picked from commit c7400fe1df4e971670a7628ddcc856f7a6775dc6) --- stand/common/load_elf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index 6d4cc5335bda..bd02bc2e30ef 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -642,6 +642,12 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) if (phdr[i].p_type != PT_LOAD) continue; + if (phdr[i].p_memsz < phdr[i].p_filesz) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: invalid PT_LOAD segment\n"); + goto out; + } + if (module_verbose >= MODULE_VERBOSE_FULL) { printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", (long)phdr[i].p_filesz, (long)phdr[i].p_offset,