2
0
mirror of git://sourceware.org/git/glibc.git synced 2024-12-21 04:31:04 +08:00
glibc/elf/tst-tls19mod3.c
Martin von Gagern d26dfc60ed Fix handling of static TLS in dlopen'ed objects
When dynamically loading a library along with several dependencies, calls to
_dl_add_to_slotinfo and _dl_update_slotinfo can become intermixed. As a
consequence, _dl_update_slotinfo will update the generation counter of the dtv
although not all of the slots belonging to that generation have been added.
Subsequent calls to _dl_add_to_slotinfo will add more slots to the same
generation, for which no storage will be allocated, as the dtv generation
checks will claim no work is necessary. This will lead to uninitialized dtv
entries and will likely cause a SIGSEGV when thread local variables are
accessed.
2011-05-14 21:25:43 -04:00

17 lines
202 B
C

#include <stdio.h>
static int __thread tbaz __attribute__ ((tls_model ("local-dynamic"))) = 42;
void
setter2 (int a)
{
tbaz = a;
}
int
baz (void)
{
printf ("&tbaz=%p\n", &tbaz);
return tbaz;
}