|
|
@@ -900,7 +900,15 @@ _dl_tls_get_addr_soft (struct link_map *map)
|
|
|
if (map->l_tls_modid == 0)
|
|
|
return NULL;
|
|
|
|
|
|
+ /* This is called from dl_iterate_phdr to fill dl_phdr_info::dlpi_tls_data,
|
|
|
+ which the unwinder invokes during stack unwinding (e.g. pthread
|
|
|
+ cancellation). In such contexts the calling thread may not have a
|
|
|
+ usable thread pointer / DTV yet (or any more), so THREAD_DTV() can
|
|
|
+ come back as a near-null bogus pointer. dlpi_tls_data is optional,
|
|
|
+ so bail out instead of dereferencing it. */
|
|
|
dtv = THREAD_DTV ();
|
|
|
+ if (dtv == NULL || (uintptr_t) dtv < 4096)
|
|
|
+ return NULL;
|
|
|
if (map->l_tls_modid > (size_t) dtv[-1].counter)
|
|
|
return NULL;
|
|
|
|