Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 261104 Details for
Bug 353224
sys-libs/glibc-2.12.2: Broken thread local storage (TLS) initialization
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Do update_slotinfo after add_to_slotinfo
gentoo353224a.patch (text/plain), 2.18 KB, created by
Martin von Gagern
on 2011-01-30 15:03:51 UTC
(
hide
)
Description:
Do update_slotinfo after add_to_slotinfo
Filename:
MIME Type:
Creator:
Martin von Gagern
Created:
2011-01-30 15:03:51 UTC
Size:
2.18 KB
patch
obsolete
>Fix a bug in tls initialization which caused __tls_get_addr to return NULL. > >We need to postpone all calls to _dl_update_slotinfo until after >_dl_add_to_slotinfo is complete. This is because _dl_update_slotinfo >will modify the generation of the DTV to match that of the new >slot. We cannot allow this to happen until all slots of the generation >have been added. > >2010-01-30 Martin von Gagern > >References: >https://github.com/cschwan/sage-on-gentoo/issues/#issue/40 >https://bugs.gentoo.org/353224 > >Index: glibc-2.12.2/elf/dl-open.c >=================================================================== >--- glibc-2.12.2.orig/elf/dl-open.c >+++ glibc-2.12.2/elf/dl-open.c >@@ -346,7 +346,7 @@ dl_open_worker (void *a) > > /* If the file is not loaded now as a dependency, add the search > list of the newly loaded object to the scope. */ >- bool any_tls = false; >+ bool any_tls = false, any_static_tls = false; > for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i) > { > struct link_map *imap = new->l_searchlist.r_list[i]; >@@ -426,6 +426,25 @@ dl_open_worker (void *a) > _dl_add_to_slotinfo (imap); > > if (imap->l_need_tls_init) >+ any_static_tls = true; >+ >+ /* We have to bump the generation counter. */ >+ any_tls = true; >+ } >+ } >+ >+ /* We need a second pass for static tls data, because _dl_update_slotinfo >+ must not be run while calls to _dl_add_to_slotinfo are still pending. */ >+ if (__builtin_expect (any_static_tls, 0)) >+ { >+ for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i) >+ { >+ struct link_map *imap = new->l_searchlist.r_list[i]; >+ if (__builtin_expect (imap->l_need_tls_init, 0) >+ /* The following two can likely be dropped, but let's be extra >+ safe and copy all the conditions for now. */ >+ && ! imap->l_init_called >+ && __builtin_expect (imap->l_tls_blocksize > 0, 0)) > { > /* For static TLS we have to allocate the memory here > and now. This includes allocating memory in the DTV. >@@ -449,9 +468,6 @@ cannot load any more object with static > GL(dl_init_static_tls) (imap); > assert (imap->l_need_tls_init == 0); > } >- >- /* We have to bump the generation counter. */ >- any_tls = true; > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 353224
:
261100
| 261104