summaryrefslogtreecommitdiff
path: root/ldso/dynlink.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2021-03-26 13:35:41 -0400
committerRich Felker <dalias@aerifal.cx>2021-03-26 13:35:41 -0400
commit521b4d27a00b12b238b3d4284a2c490daf851ab1 (patch)
tree4df62c4e0082782e61396226741cd4108f3a0f19 /ldso/dynlink.c
parent122002f0ddf267977282f05066a0794e31661501 (diff)
downloadmusl-521b4d27a00b12b238b3d4284a2c490daf851ab1.tar.gz
fix dl_iterate_phdr dlpi_tls_data reporting to match spec
dl_iterate_phdr was wrongly reporting the address of the DSO's PT_TLS image rather than the calling thread's instance of the TLS. the man page, which is essentially normative for a nonstandard function of this sort, clearly specifies the latter. it does not clarify where exactly within/relative-to the image the pointer should point, but the reasonable thing to do is match the ABI's DTP offset, and this seems to be what other implementations do.
Diffstat (limited to 'ldso/dynlink.c')
-rw-r--r--ldso/dynlink.c2
1 files changed, 1 insertions, 1 deletions
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 = gencnt;
info.dlpi_subs = 0;
info.dlpi_tls_modid = current->tls_id;
- info.dlpi_tls_data = current->tls.image;
+ info.dlpi_tls_data = __tls_get_addr((tls_mod_off_t[]){current->tls_id,0});
ret = (callback)(&info, sizeof (info), data);