This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC PATCH 1/2][BZ 19329] remove broken code path for easier code review
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Cc: <nd at arm dot com>, Torvald Riegel <triegel at redhat dot com>
- Date: Wed, 30 Nov 2016 11:44:25 +0000
- Subject: [RFC PATCH 1/2][BZ 19329] remove broken code path for easier code review
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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.
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;