From nobody Thu Aug 6 18:03:29 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 4hGFWk0J7Tz6nRGB for ; Thu, 06 Aug 2026 18:03:30 +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 4hGFWj3Ppcz3gkY for ; Thu, 06 Aug 2026 18:03:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786039409; 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=MQTc+QeYbyOF2SWOeyoWUXTPqjI0ObThRS/0pt39/W4=; b=rTiiDPtzNRVn/ArblM2S1b0vWVcP6HzV9xeA99hA22+Ag9qqX3mpKRuBcCFBxXQJlSmvS4 CEeH2095BIDtCBlnpS8iEfuCpu80t1G2GD0LMq0NT6r44/XIV6u4CFf413r1MS/rXN1fq7 kAodWW1nowVOm7CD9lphsNWL9sjboac59JT6T7If8Jerv75siG6ty8gEfMcRxfxyI1h8PC sEsxKesGi/dxXYpbzeLs50HViGyhMHCu1iEWKuq0JgT9W9Sih8jTzHtLoZJw6Qh3lLuDoF Vrlybayq6EwcxMU9Ok9g6OLjpWXdhkJg6Nv7ZKTF3QkD8ZypHkh+14QSoQkXmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786039409; a=rsa-sha256; cv=none; b=przKxUN4jItyvr+Y1MbJJFh2gCRayTZFV5O232MNLyiyG6xKjPZPyf1UeKLLQh3MVySNM7 iSNAqcbwCs5l0dRn2nhsB8AKC8nIWmc67m4M+T26EPDhkJmCw/4TOYf10XsciejjB+nRTw SzxjPLWIr8bdwdKDNUon8h2tkSyOZ17a9f8HHDlnkdnq5BhxCnPQy9iV8uvOs3b6j7n32b W1xemCvVxbylhmpkvu5y9eYjfTAZZ9BAly6KWYFIIevqS+XZESjZHXMrevjXjV4CWoeGE8 5JqiBuI6kJLvJJqjJwNYVZEgxSznGgdolMzEr9faoDTmk+kGIMhZ/F9yTZpthg== 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=1786039409; 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=MQTc+QeYbyOF2SWOeyoWUXTPqjI0ObThRS/0pt39/W4=; b=E/K16YVXrUyFbQ1ZrdBo2cx9Q1arvy4zuK9Idowtnt6xTf+lNqE6uBlFB+SOHAeqX+oMJQ NxCBp1HV+2QggbNNw7oAJWKdZ+5SQbiWANtxXCkTEEp4S/wbVgUaNk4LupnmmnfRm2igOa qU85egsss7+qxNPPFxa6gTVtyPj7SATgXN06mS6L+HEig6PGvB4df+454eLNyMTYQ+owtH y+bQzl8WMgMPP1hhN2Zmnzy0/bGpk/3/43+6NeLDNw98nkqWcI3zur8H/uJZP8MLXe2gux j4Idoh6EPXx/8iITal1JeiJIzq//0i4Y4mtzTkFt1EXosVqf89wQVGBrZV4+5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hGFWj2Nn9zXGk for ; Thu, 06 Aug 2026 18:03:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32892 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 06 Aug 2026 18:03:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 9facb187c9aa - stable/15 - link_elf: Make phdrs first page check actually fatal 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: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 9facb187c9aa02ced20338bf69c6f6e59ac1030a Auto-Submitted: auto-generated Date: Thu, 06 Aug 2026 18:03:29 +0000 Message-Id: <6a74cc71.32892.76042a04@gitrepo.freebsd.org> The branch stable/15 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=9facb187c9aa02ced20338bf69c6f6e59ac1030a commit 9facb187c9aa02ced20338bf69c6f6e59ac1030a Author: Jessica Clarke AuthorDate: 2026-07-29 14:09:42 +0000 Commit: Jessica Clarke CommitDate: 2026-08-06 18:02:34 +0000 link_elf: Make phdrs first page check actually fatal Otherwise we'll print an error but carry on regardless, presumably destined to walk off the end of the mapping. Reported by: thebugfixers@pm.me MFC after: 1 week (cherry picked from commit 1e39a314d870e312f623199e146eda6bdbc293a3) --- sys/kern/link_elf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index d12495504c81..ef4609333d3d 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -1086,8 +1086,11 @@ link_elf_load_file(linker_class_t cls, const char* filename, */ if (!((hdr->e_phentsize == sizeof(Elf_Phdr)) && (hdr->e_phoff + hdr->e_phnum*sizeof(Elf_Phdr) <= PAGE_SIZE) && - (hdr->e_phoff + hdr->e_phnum*sizeof(Elf_Phdr) <= nbytes))) + (hdr->e_phoff + hdr->e_phnum*sizeof(Elf_Phdr) <= nbytes))) { link_elf_error(filename, "Unreadable program headers"); + error = ENOEXEC; + goto out; + } /* * Scan the program header entries, and save key information.