+2016-09-21 Alexandre Oliva <aoliva@redhat.com>
+
+ [BZ #19826]
+ * elf/dl-tls.c (_dl_allocate_tls_init): Restore DTV early
+ initialization of static TLS entries.
+ * elf/dl-reloc.c (_dl_nothread_init_static_tls): Likewise.
+ * nptl/allocatestack.c (init_one_static_tls): Likewise.
+
2016-09-22 Samuel Thibault <samuel.thibault@ens-lyon.org>
* hurd/hurdmalloc.c (malloc_fork_prepare): Rename to
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
+ /* Fill in the DTV slot so that a later LD/GD access will find it. */
+ dtv_t *dtv = THREAD_DTV ();
+ assert (map->l_tls_modid <= dtv[-1].counter);
+ dtv[map->l_tls_modid].pointer.to_free = NULL;
+ dtv[map->l_tls_modid].pointer.val = dest;
+
/* Initialize the memory. */
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
+ /* Set up the DTV entry. The simplified __tls_get_addr that
+ some platforms use in static programs requires it. */
+ dtv[map->l_tls_modid].pointer.val = dest;
+
/* Copy the initialization image and clear the BSS part. */
memset (__mempcpy (dest, map->l_tls_initimage,
map->l_tls_initimage_size), '\0',
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- /* We cannot delay the initialization of the Static TLS area, since
- it can be accessed with LE or IE, but since the DTV is only used
- by GD and LD, we can delay its update to avoid a race. */
+ /* Fill in the DTV slot so that a later LD/GD access will find it. */
+ dtv_t *dtv = GET_DTV (TLS_TPADJ (curp));
+ dtv[map->l_tls_modid].pointer.to_free = NULL;
+ dtv[map->l_tls_modid].pointer.val = dest;
+
+ /* Initialize the memory. */
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}