unofficial mirror of
 help / color / mirror / code / Atom feed
From: Siddhesh Poyarekar via Libc-alpha <>
Subject: [PATCH v2] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
Date: Wed, 28 Jul 2021 12:58:54 +0530	[thread overview]
Message-ID: <> (raw)

Abort in the unlikely event that allocation fails when trying to
register a TLS destructor.
 stdlib/cxa_thread_atexit_impl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
index 577ed30931..d789f043f2 100644
--- a/stdlib/cxa_thread_atexit_impl.c
+++ b/stdlib/cxa_thread_atexit_impl.c
@@ -72,6 +72,7 @@
    is not very different from a case where __call_tls_dtors is called after
    _dl_close_worker on the DSO and hence is an accepted execution.  */
+#include <stdio.h>
 #include <stdlib.h>
 #include <ldsodefs.h>
@@ -104,6 +105,8 @@ __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
   /* Prepend.  */
   struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
+  if (__glibc_unlikely (new == NULL))
+    __libc_fatal ("failed to register TLS destructor: out of memory");
   new->func = func;
   new->obj = obj;
   new->next = tls_dtor_list;

             reply	other threads:[~2021-07-28  8:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  7:28 Siddhesh Poyarekar via Libc-alpha [this message]
2021-07-28  7:31 ` Florian Weimer via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: [PATCH v2] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).