public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
Date: Wed, 28 Jul 2021 10:38:28 +0000 (GMT)	[thread overview]
Message-ID: <20210728103828.2ECAB3853C1C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4aedc25f55eda50010f2932fdb0a533db6f89f61

commit 4aedc25f55eda50010f2932fdb0a533db6f89f61
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Jul 28 13:11:20 2021 +0530

    __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
    
    Abort in the unlikely event that allocation fails when trying to
    register a TLS destructor.
    
    Reviewed-by: Florian Weimer <fweimer@redhat.com>

Diff:
---
 stdlib/cxa_thread_atexit_impl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
index 577ed30931..fa6901a3a6 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,9 @@ __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 ("Fatal glibc error: failed to register TLS destructor: "
+		  "out of memory\n");
   new->func = func;
   new->obj = obj;
   new->next = tls_dtor_list;


                 reply	other threads:[~2021-07-28 10:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20210728103828.2ECAB3853C1C@sourceware.org \
    --to=siddhesh@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).