Date: Mon, 05 Apr 2021 01:02:53 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 254774] [rtld] dl_iterate_phdr: dlpi_tls_data should be the iterated module's TLS image instead of TLS initialization image Message-ID: <bug-254774-227-ceBqFpOcwA@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-254774-227@https.bugs.freebsd.org/bugzilla/> References: <bug-254774-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254774 --- Comment #1 from maskray <emacsray@gmail.com> --- Note: dlpi_tls_data is essentially __tls_get_addr((tls_mod_off_t[]){1,0}) on both TLS Variant I and Variant II architectures. musl has the same problem. Rich has acknoledged the problem and will fix it with: diff --git a/ldso/dynlink.c b/ldso/dynlink.c index aaadcce0..b66ad537 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -2331,7 +2331,7 @@ int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void info.dlpi_adds =3D gencnt; info.dlpi_subs =3D 0; info.dlpi_tls_modid =3D current->tls_id; - info.dlpi_tls_data =3D current->tls.image; + info.dlpi_tls_data =3D __tls_get_addr((tls_mod_off_t[]){current->tls_id,0}); ret =3D (callback)(&info, sizeof (info), data); diff --git a/src/ldso/dl_iterate_phdr.c b/src/ldso/dl_iterate_phdr.c index 86c87ef8..9546dd36 100644 --- a/src/ldso/dl_iterate_phdr.c +++ b/src/ldso/dl_iterate_phdr.c @@ -1,5 +1,6 @@ #include <elf.h> #include <link.h> +#include "pthread_impl.h" #include "libc.h" #define AUX_CNT 38 @@ -35,7 +36,7 @@ static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size info.dlpi_subs =3D 0; if (tls_phdr) { info.dlpi_tls_modid =3D 1; - info.dlpi_tls_data =3D (void *)(base + tls_phdr->p_vaddr); + info.dlpi_tls_data =3D __tls_get_addr((tls_mod_off_t[]){1,0= }); } else { info.dlpi_tls_modid =3D 0; info.dlpi_tls_data =3D 0; --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-254774-227-ceBqFpOcwA>