Date: Wed, 7 May 2025 19:22:05 GMT From: Jessica Clarke <jrtc27@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 7953cbaabe7c - main - libc: Reassociate pointer arithmetic in __libc_tls_get_addr Message-ID: <202505071922.547JM5BV042924@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7953cbaabe7c35d439f0222481a12ad52d0b0df0 commit 7953cbaabe7c35d439f0222481a12ad52d0b0df0 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2025-05-07 19:19:42 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2025-05-07 19:19:42 +0000 libc: Reassociate pointer arithmetic in __libc_tls_get_addr Rather than compute a biased pointer only to then un-bias it again, un-bias the offset before adding it to the DTV entry. This mirrors rtld-elf commit d71c97026366 ("rtld-elf: Push TLS_DTV_OFFSET into tls_get_addr_common's arguments") Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D50224 --- lib/libc/gen/tls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 8d453eccb801..218cd1da92df 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -85,8 +85,8 @@ __libc_tls_get_addr(void *vti) dtv = _tcb_get()->tcb_dtv; ti = vti; - return ((char *)(dtv[ti->ti_module + 1] + ti->ti_offset) + - TLS_DTV_OFFSET); + return ((char *)dtv[ti->ti_module + 1] + (ti->ti_offset + + TLS_DTV_OFFSET)); } #ifdef __i386__
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505071922.547JM5BV042924>