This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: tunables failure indications...


?

>From d64d1ddf3d79a1e51612f8e4ae3ecfd020246275 Mon Sep 17 00:00:00 2001
From: DJ Delorie <dj@redhat.com>
Date: Fri, 13 Dec 2019 13:36:58 -0500
Subject: tunables: report sbrk() failure


diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index e625ac1a7d..3a3f8096c2 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -45,12 +45,14 @@ tunables_strdup (const char *in)
   while (in[i++] != '\0');
   char *out = __sbrk (i);
 
-  /* FIXME: In reality if the allocation fails, __sbrk will crash attempting to
-     set the thread-local errno since the TCB has not yet been set up.  This
-     needs to be fixed with an __sbrk implementation that does not set
-     errno.  */
+  /* For most of the tunables code, we ignore user errors.  However,
+     this is a system error - and running out of memory at program
+     startup should be reported, so we do.  */
   if (out == (void *)-1)
-    return NULL;
+    {
+      _dl_fatal_printf("sbrk() failure while processing tunables\n");
+      _exit (1);
+    }
 
   i--;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]