mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 09:43:32 +08:00
d26dfc60ed
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.
16 lines
197 B
C
16 lines
197 B
C
#include <stdio.h>
|
|
|
|
extern int bar (void);
|
|
extern int baz (void);
|
|
|
|
int
|
|
foo (void)
|
|
{
|
|
int v1 = bar ();
|
|
int v2 = baz ();
|
|
|
|
printf ("bar=%d, baz=%d\n", v1, v2);
|
|
|
|
return v1 != 666 || v2 != 42;
|
|
}
|