|
|
548bcb |
commit c489c35054c39d7f2437ca61b369e3ede448f022
|
|
|
548bcb |
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
|
548bcb |
Date: Wed Nov 30 11:44:25 2016 +0000
|
|
|
548bcb |
|
|
|
548bcb |
elf: Fix comments and logic in _dl_add_to_slotinfo
|
|
|
548bcb |
|
|
|
548bcb |
Since
|
|
|
548bcb |
|
|
|
548bcb |
commit a509eb117fac1d764b15eba64993f4bdb63d7f3c
|
|
|
548bcb |
Avoid late dlopen failure due to scope, TLS slotinfo updates [BZ #25112]
|
|
|
548bcb |
|
|
|
548bcb |
the generation counter update is not needed in the failure path.
|
|
|
548bcb |
That commit ensures allocation in _dl_add_to_slotinfo happens before
|
|
|
548bcb |
the demarcation point in dlopen (it is called twice, first time is for
|
|
|
548bcb |
allocation only where dlopen can still be reverted on failure, then
|
|
|
548bcb |
second time actual dtv updates are done which then cannot fail).
|
|
|
548bcb |
|
|
|
548bcb |
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
548bcb |
|
|
|
548bcb |
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
|
|
|
548bcb |
index 0b96b1dceed99d58..9375650a3ab5247d 100644
|
|
|
548bcb |
--- a/elf/dl-tls.c
|
|
|
548bcb |
+++ b/elf/dl-tls.c
|
|
|
548bcb |
@@ -998,16 +998,7 @@ _dl_add_to_slotinfo (struct link_map *l, bool do_add)
|
|
|
548bcb |
+ TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo));
|
|
|
548bcb |
if (listp == NULL)
|
|
|
548bcb |
{
|
|
|
548bcb |
- /* We ran out of memory. We will simply fail this
|
|
|
548bcb |
- call but don't undo anything we did so far. The
|
|
|
548bcb |
- application will crash or be terminated anyway very
|
|
|
548bcb |
- soon. */
|
|
|
548bcb |
-
|
|
|
548bcb |
- /* We have to do this since some entries in the dtv
|
|
|
548bcb |
- slotinfo array might already point to this
|
|
|
548bcb |
- generation. */
|
|
|
548bcb |
- ++GL(dl_tls_generation);
|
|
|
548bcb |
-
|
|
|
548bcb |
+ /* We ran out of memory while resizing the dtv slotinfo list. */
|
|
|
548bcb |
_dl_signal_error (ENOMEM, "dlopen", NULL, N_("\
|
|
|
548bcb |
cannot create TLS data structures"));
|
|
|
548bcb |
}
|