unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
@ 2021-07-28  7:42 Siddhesh Poyarekar via Libc-alpha
  2021-07-28  7:46 ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 2+ messages in thread
From: Siddhesh Poyarekar via Libc-alpha @ 2021-07-28  7:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer

Abort in the unlikely event that allocation fails when trying to
register a TLS destructor.
---
 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;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524]
  2021-07-28  7:42 [PATCH v3] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524] Siddhesh Poyarekar via Libc-alpha
@ 2021-07-28  7:46 ` Florian Weimer via Libc-alpha
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer via Libc-alpha @ 2021-07-28  7:46 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: libc-alpha

* Siddhesh Poyarekar:

> Abort in the unlikely event that allocation fails when trying to
> register a TLS destructor.

Okay, thanks.

Florian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-28  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28  7:42 [PATCH v3] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524] Siddhesh Poyarekar via Libc-alpha
2021-07-28  7:46 ` Florian Weimer via Libc-alpha

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).