From nobody Fri Jul 31 17:57:37 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 4hBYgk4f13z6nFHT for ; Fri, 31 Jul 2026 17:57:38 +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 4hBYgk1bXYz467m for ; Fri, 31 Jul 2026 17:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785520658; 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=8N2pDUEiQnkTaOILW2NwObhfF6yZ7diPmJXk5dv4IFs=; b=lz0ToaW1n5ARdQZ59DSliKjFhv0TTvxgc2BbNL7wLFEyh/v82nEo8N1eMAv58sTE7+6qJT nF9b0WYpkbClAvTqOeaZmWvqxmiFysFiInPkh5XdkRlXSl6l+WblCqzWGWwsXmN0uQqgBn Ay08CF1UJNipUbe8K8YDEC1mtx0V8s0YEnwVRuI0PkAhuKrZVUBS1h+YmS9wfgqHn3eSUu IgT1MhP3v+V8LJ7mWnQoTfnizh61NtH8/ogy2U/Lq2JOXGfc7Sfr9x/fyw0+SqV1HJoD1n ai4UR8yeFF1DtSIQrBE+WSA6hH7mi2PXLbB4PIKtc1KQmsEvSm1fF5Jf8339GQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785520658; a=rsa-sha256; cv=none; b=vxYrLrz5042K3jdIJ57kPUePkhsdle1p4HDPWGo367rSmEkfTm5BySEwYgefT57cEsiMaW 0n3CUaKUkLnpsfR4e5p6Nh5O3qm1uDwMCK0Y/7191DLosfwMb51uxKp8gjY0zKKrW4YC5z LiytrwjCJ8pBxi3d9FJM6p07rSVkmUFMRlDCpfwW3tobLjYb+KeQUvv7EtHvYHdR1ih8fB TB1I5GNAmunxFt4L5hLwGxiSDz60na/iAHT6tIvSqi5Bl9tbZTHhQO6r75xXzOao2lyeTS 4HhW3p4KfOLJBBO2HHfOyQmAKzQm0+pUSIgVcBoE36O9AHpw4Ve3/Xc8/j9Yzg== 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=1785520658; 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=8N2pDUEiQnkTaOILW2NwObhfF6yZ7diPmJXk5dv4IFs=; b=lpZG3aV1ihYfRrz7xTahQv7JXHlEOzPG7sHqeVYpu4kNLYq8+qLfF9y/hexTcgiEmXPr1J ygbPbpMiISEzEPQSKTzflM1ZON4EtD1QPhxjSy9KcIDiZ9yUmiF3iTG3oNkkUR7oJtEdnf bC4ZxmXh0mn1tJ/jIg+v0LgTCs85HUP5GCoFuI+sIwpoWUl2ZS8By6NLOwESjWiBSfTw0D 0Qn02qcSPnOuno1lc7nXTjJ5DcxoOgGxwZLepQMtvNTlznOEVIRjHLrGr0j6xcGZ0fOyiE c2FhyoZO0r2V4V5E0KkR7Fcw1n80ZCEPwM30qKU54yz0GEAAO1c1nsut75y14A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hBYgj6xqLz1965 for ; Fri, 31 Jul 2026 17:57:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f35c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 31 Jul 2026 17:57:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b9eaf9b7cef2 - main - libc: Reject static ELF exectables with PT_TLS segments were filesz > memsz 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9eaf9b7cef25228e8c20e3819f1b7be94f486aa Auto-Submitted: auto-generated Date: Fri, 31 Jul 2026 17:57:37 +0000 Message-Id: <6a6ce211.3f35c.64cfbffb@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b9eaf9b7cef25228e8c20e3819f1b7be94f486aa commit b9eaf9b7cef25228e8c20e3819f1b7be94f486aa Author: John Baldwin AuthorDate: 2026-07-31 17:52:34 +0000 Commit: John Baldwin CommitDate: 2026-07-31 17:52:34 +0000 libc: Reject static ELF exectables with PT_TLS segments were filesz > memsz Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D58558 --- lib/libc/gen/tls.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index b26b13d45589..e9f256d5e369 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -435,6 +435,10 @@ _init_tls(void) for (i = 0; (unsigned) i < phnum; i++) { if (phdr[i].p_type == PT_TLS) { + if (phdr[i].p_memsz < phdr[i].p_filesz) { + tls_msg("_init_tls: invalid PT_TLS segment.\n"); + abort(); + } libc_tls_static_space = roundup2(phdr[i].p_memsz, phdr[i].p_align); libc_tls_init_size = phdr[i].p_filesz;