summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-19 21:45:02 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-19 21:45:02 +0000
commita245eafd2b5967c34ec224a8e7ae72e8edd437b8 (patch)
tree9b2e68b98806dfd735a1446db2be398a24e153db
parent153aa31b93be22e01b236375fb02a9f9b9a0195f (diff)
[BZ #10069]
2009-04-19 Ulrich Drepper <drepper@redhat.com> [BZ #10069] * elf/dl-open.c (dl_open_worker): We cannot guarantee that we can load an object that uses static TLS if the TLS modid is higher than the reserve we always allocate. At least for multi-threaded code.
-rw-r--r--ChangeLog7
-rw-r--r--elf/dl-open.c12
2 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 79035e8bbc..7e46b68353 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-19 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #10069]
+ * elf/dl-open.c (dl_open_worker): We cannot guarantee that we can load
+ an object that uses static TLS if the TLS modid is higher than the
+ reserve we always allocate. At least for multi-threaded code.
+
2009-04-18 Ulrich Drepper <drepper@redhat.com>
* stdlib/strfmon_l.c (__vstrfmon_l): Don't wrap when computing width.
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 458cf0cd13..c3f0e42d5e 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -490,6 +490,18 @@ dl_open_worker (void *a)
if (imap->l_need_tls_init)
{
+ /* For static TLS we have to allocate the memory here
+ and now. This includes allocating memory in the DTV.
+ But we cannot change any DTV other than our own. So,
+ if we cannot guarantee that there is room in the DTV
+ we don't even try it and fail the load.
+
+ XXX We could track the minimum DTV slots allocated in
+ all threads. */
+ if (! RTLD_SINGLE_THREAD_P && imap->l_tls_modid > DTV_SURPLUS)
+ _dl_signal_error (0, "dlopen", NULL, N_("\
+cannot load any more object with static TLS"));
+
imap->l_need_tls_init = 0;
#ifdef SHARED
/* Update the slot information data for at least the