From nobody Wed Jul 29 14:11:23 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 4h9Dlk5fCmz6nHhs for ; Wed, 29 Jul 2026 14:11: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 4h9Dlj5RyGz484H for ; Wed, 29 Jul 2026 14:11:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785334289; 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=3wO05fiWYzsFqtlcz1CyoPWkCX8P7oS/Zynm40RzlWA=; b=KtchuaEKH2Q1L3/NAjaDhGDrQ3Nf2UZ1wn2nWe3wlraG1KD7SQ4+e79cvpKDMY4UX6iBhZ 2t/FY35J0YrammhxTFURaMN77yirXKCgYprDAgCfst9yh53ahFA2un9dYgFu0HR13wWZhQ AWtnIzPElLquJa/Q3FSKRvd30ryEJY9n8l8HtC4v5y4xcdLfNiHk1PUX8WkPE1IBwpoJJP ++Gr9m2AskUO6mFVGhrTQX1Hzi9Ts9d5034IcdKPP5UrLDqIZ3Qb9OMB5uMVzbYfwocAnc CdkpjNh0EeWtxOox4KxJnUHCU5lYuFHX0nfP1p2XwBu1uWXFqUMFrF6x4ZQbmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785334289; a=rsa-sha256; cv=none; b=fhh1ypYQgTANb7xXoPsUthOpt7idNGTu8OgHCTdyz8LpYhOCj8cxHZ2bnluZD7kNdvBru7 ZQqHVUXutxbCA8qrszsuKomfyTxH4u+KBpETvSDCjo4KuvczslDVFCe3jMUBx7EySb+P94 NGdjf6j0WNb6U4Jezv5whbiKqkFdISJWCUoF92Z9I0Ilgm3GmdOSzqfqJozT02UveMmKxz BmV0MYaZzR3NW9N2uR3cNW24UVwyP9eFN3oXKrIVjlIzp+EPI+w1wDU1ugA+gE8qdIqGOS ZPjnZYhcYxQZrHNc/LNS7piNQhPYCreyh8UGHIe9oG50JmjGBIt/hs/kGgce7Q== 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=1785334289; 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=3wO05fiWYzsFqtlcz1CyoPWkCX8P7oS/Zynm40RzlWA=; b=HZcDFJxyNYBr6WFycOuHBBpKeuy1N0ORAKHoBZCvcF3iZI7E+JWHpvBw6MMy2FGy8+K7x7 e0wiv5cDi70VsEcMTuK4ecUxzOflywf6/O5/J6uTi7bl+VYrLGtVwbKVnhAT1jb5A+H4eQ 5M5o4yhDS7izxsfY6ar9A9TXIFP7AhpzQDFUget1VXLT+kcKnNweVURhUJpMJ8z056nwI0 hQPm7ICh/ERkTYWX1iKIJJsGMnsFKyMpg2HMoU5djCAYeQwQZ/BhqFiqnYLQHoGYvXdiyQ AMU1enQFWjma2NBMV3rto+JeivCQKCFSRg4J4bODLLuF1d+Ew17jl4U4fC8MZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h9Dlh6xN2zTqQ for ; Wed, 29 Jul 2026 14:11:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 197de by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 29 Jul 2026 14:11:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 1e39a314d870 - main - link_elf: Make phdrs first page check actually fatal List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 1e39a314d870e312f623199e146eda6bdbc293a3 Auto-Submitted: auto-generated Date: Wed, 29 Jul 2026 14:11:23 +0000 Message-Id: <6a6a0a0b.197de.5185cb8b@gitrepo.freebsd.org> The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=1e39a314d870e312f623199e146eda6bdbc293a3 commit 1e39a314d870e312f623199e146eda6bdbc293a3 Author: Jessica Clarke AuthorDate: 2026-07-29 14:09:42 +0000 Commit: Jessica Clarke CommitDate: 2026-07-29 14:09:42 +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 --- 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 613dfe0133d4..6ab5f4a39580 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.