From nobody Mon Dec 15 18:18:50 2025 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 4dVSxR1QHlz6L7Gd for ; Mon, 15 Dec 2025 18:18: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dVSxQ4c8hz4LKG for ; Mon, 15 Dec 2025 18:18:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765822730; 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=5qNQmddzhxM/eVRd6hap8gRzFk0vbo4F9i9CRW+PTSs=; b=Svi0NAFeb7mIjafaEHiEsrhgynFUFBZOdOE4X1O80sop+jli/MFX6D3Qy8FN2bpMuSxfzu 9Z1SxI0QROq/krJI//9KE2qtrPo7Y5D9CcD2+Q94BxqYgiWybg2PdAW89OQFKow41asibB yViyQdUm3/1pdSGaCXRQUjXVtB29maclB3vyWu3G9+9cfYZIOHgy9bSX/B/j2ClumvtCND 9Kimze428FhSuCcT4FhlGNRHQzKDt+GUI3Cz7EVHdJtPKUdxsEDorOCHcNfoim1r9P1sIh 7+nIZXsXgULuodDK89m4rtnJewkZf3FAhujPqAFodzE/OzRN0W3+2iH4ekTJUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765822730; 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=5qNQmddzhxM/eVRd6hap8gRzFk0vbo4F9i9CRW+PTSs=; b=xNsQhZyFg/+FrIKpOLm2C6nwgIHghH/FIG5znxi2RBi00fb1TwQM1v8Cc9z+dESIXlY5Ce 6nhWBLnPHGE7Q1NDRIg0cf4Y1X7Jt86PjA6jevEReeBwbB0OisvuiVJpIlDSe1UcvUdeKX IuIVgxYQaTWAYqQbKPnobwDgXpBiwxs7eOuAcGpUOOs4OxDKfX+h5u0VqUDKpYxXEFKLYR 7efTl4lTcxTMfPK/+pTgcVuXhF1ZtL+auDY4A2IN5KQfb1B0Khb21VpNq8UOKob65f2yll DDhIf30sycbvr9S+SBTB4fzsJeMJVSwZeIRsuYZh0VpzA+7oMzNCTeVA+h/OYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765822730; a=rsa-sha256; cv=none; b=ncthhNxGc4RDJeC/QyMlf6UczVnqiVcJZip2nGeoV+bVeno12iVXx5K6hF+QhqbNXV9BcH 46sACvEcSMK2+OOxUgVMHplNizhDrfE0/p5pZFaJ4zmnstt36xhm9A7/la6NhjnQUv1JZ8 7uVxWtXQO40t1WgiNmnEn3iqzEEFdMcamZISkDFhRIAFV1XSAVQ+/rF3zsplSUciXaaDm4 nEe8vOzsFWUEYpAoEQ+TuzOgFbGcPcEY1jn+GEDtplD4WmPInYYjsEo7WC63ZD9Y+/2pCk T8pzCtbHJbjEsg5u4o1aeC89n6ZLEkxkG0RZh7AJQUGN3EvuAT2Wrt8cjh2aMQ== 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 4dVSxQ3tZYzWnB for ; Mon, 15 Dec 2025 18:18:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 254b1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 15 Dec 2025 18:18:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: d5e9943bec69 - stable/13 - rtld-elf: Fix dlsym(3) for TLS symbols on PowerPC and RISC-V 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 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/13 X-Git-Reftype: branch X-Git-Commit: d5e9943bec698945a68539911c27dc88ccf37a4b Auto-Submitted: auto-generated Date: Mon, 15 Dec 2025 18:18:50 +0000 Message-Id: <6940510a.254b1.67a25b47@gitrepo.freebsd.org> The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=d5e9943bec698945a68539911c27dc88ccf37a4b commit d5e9943bec698945a68539911c27dc88ccf37a4b Author: Jessica Clarke AuthorDate: 2025-05-06 22:14:51 +0000 Commit: Jessica Clarke CommitDate: 2025-12-15 17:56:36 +0000 rtld-elf: Fix dlsym(3) for TLS symbols on PowerPC and RISC-V The implementation here is meant to mirror what a GOT entry for the given symbol would use for ti_offset. However, on PowerPC and RISC-V, TLS_DTV_OFFSET is non-zero, and so the GOT entries are normally biased by this, but we fail to do so here. As a result we end up getting a pointer TLS_DTV_OFFSET past where the variable actually is. (Note this also applies to MIPS on stable/13) Reviewed by: kib Fixes: 5ceeeba90c6c ("Import DragonFly BSD commit") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D50183 (cherry picked from commit 8ad9cec3a2cc643020a286ee68f70eb01225fbdd) --- libexec/rtld-elf/rtld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index d3c696145d5c..a43c6e3c7cda 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -4082,7 +4082,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, sym = rtld_resolve_ifunc(defobj, def); else if (ELF_ST_TYPE(def->st_info) == STT_TLS) { ti.ti_module = defobj->tlsindex; - ti.ti_offset = def->st_value; + ti.ti_offset = def->st_value - TLS_DTV_OFFSET; sym = __tls_get_addr(&ti); } else sym = defobj->relocbase + def->st_value;