From nobody Thu Oct 08 20:44:03 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 4j125w3Fthz4n2yb for ; Thu, 08 Oct 2026 20:44:04 +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 4j125v6ZzKz4bx7 for ; Thu, 08 Oct 2026 20:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791492243; 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=Q5OFkjubXICKtA5G5f9hkc0TyH+xzL9my10J88M1rCQ=; b=TF1Gp8s/5H5X3KQpAuNoeWy24w0rlowI8Wpt7dm2xD9j+5TkzXuhXQ2wJpOwcHPpCeCzUQ Jecf76kTMSmIojq7ewqxyV7eVpFg3xYm2LuWGE2uZVgfogt+B7ugmRTttKC3Jhp2xKmmRQ O1k3G+ZpQ1H2LSQH6oJ1stE5ScFL6yAPqi8XAdHpLK4zAji0zA5wVZi/PT3gwQUlTjzcvi oRLpdTRaCH21BgdY6mYEV6zi75NI2gcV583CtLauhHKjBNC9hlOg9XFYtkt/Owek78ujzi 3IUOLTCxhdrKpJKl7gQg8gs1aeynxqXTwDxi4d7ucvnhFXkRiPtgWuTl3n3Ibg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791492243; b=eBvCdDZ6mS0ZyhjziWGXjMaLYx8Rcy8DMszWL4DAXfjAN7Q38xFz/uJDaB6zxhMC9wYH07 W9fuLYD3HEVLJDro547pkuxKfMrPXaYk/siZ0WQIoYKCM8+ac5raTrvIDHSEKhRdYQpCHA PPVRhvtIQTaQ4QjCHyx737KRdd6rxcTIholnhKRaYrQEj0mnbLCH6FdWXT+iWR4fU9uYPU KgRrBOxDZ0l39dtOKeg6UZkCv5JNdvfiJL/vjAhUFJsTvQwKxuHPdr9z6mFLHGaEhCmnp6 D+v16yxxhKdZHkTlD0EGQXmTUSziSzqeG5+SE5j5JeJyoXmDR+NpnL2m2JAznA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791492243; 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=Q5OFkjubXICKtA5G5f9hkc0TyH+xzL9my10J88M1rCQ=; b=s0PfaZqd5dEn/WcNbwrdf6UxoLQZ+8VOO6DlfAFvk3v4jA0Xt/lWBRCoxZ94CoPvFQ6mXj ff7stueaFhcfBWB7Ii0cW2bRZp8ULE+jxQ81EtKXcru3Y7KoCvSM2hdLo+ZHhk10PgsN0h wEwMHWi3xSIj9+7cx/KVV8cbqpcTNySCINI+w2VkDiVTv2enNog7foU52/G3Orek3VPkB6 lQ26HTp3B3rXCOs3yAFSaO14cp2N4+2qm1s0uuq7QtBgH58qauNkLTjmYRVP+PkWGo/T19 ajKRhokl5rYyFegbrhocUyyzRDTfC/Zc+D8wXXsQVaVDiUYdG1uI/6D9sHYjyA== 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 4j125v2kHfzwJ4 for ; Thu, 08 Oct 2026 20:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 333e5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 08 Oct 2026 20:44:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 6e4ef01c603c - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 6e4ef01c603c5745922902b42652125720adaa9c Auto-Submitted: auto-generated Date: Thu, 08 Oct 2026 20:44:03 +0000 Message-Id: <6ac80093.333e5.7310648a@gitrepo.freebsd.org> The branch stable/15 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6e4ef01c603c5745922902b42652125720adaa9c commit 6e4ef01c603c5745922902b42652125720adaa9c Author: John Baldwin AuthorDate: 2026-07-31 17:52:56 +0000 Commit: John Baldwin CommitDate: 2026-10-08 20:42:32 +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 3db513435271..3b78007be816 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -635,6 +635,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,