[RFC,1/2,BZ,19329] remove broken code path for easier code review

Message ID 583EBB99.8040101@arm.com
State New
Headers show

Commit Message

Szabolcs Nagy Nov. 30, 2016, 11:44 a.m.
This patch is not necessary for the bug fix, just makes concurrency
code review easier (removes a data race and overflow from a broken
code path).

dlopen can oom crash anyway in _dl_resize_dtv and it's probably
better to crash than leave half setup modules around.

2016-11-30  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* elf/dl-tls.c (_dl_add_to_slotinfo): OOM crash.

Patch hide | download patch | download mbox

diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 60f4c1d..2feee67 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -959,18 +959,10 @@  _dl_add_to_slotinfo (struct link_map *l)
 		+ TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo));
       if (listp == NULL)
 	{
-	  /* We ran out of memory.  We will simply fail this
-	     call but don't undo anything we did so far.  The
-	     application will crash or be terminated anyway very
-	     soon.  */
-
-	  /* We have to do this since some entries in the dtv
-	     slotinfo array might already point to this
-	     generation.  */
-	  ++GL(dl_tls_generation);
-
-	  _dl_signal_error (ENOMEM, "dlopen", NULL, N_("\
-cannot create TLS data structures"));
+	  /* We ran out of memory in dlopen while updating tls structures.
+	     TODO: side-effects should be rolled back and the failure should
+	     be reported to the caller, but that's hard.  */
+	  oom ();
 	}
 
       listp->len = TLS_SLOTINFO_SURPLUS;