public inbox for
help / color / mirror / Atom feed
From: Florian Weimer <>
Subject: [glibc] malloc: Use __getrandom_nocancel during tcache initiailization
Date: Mon,  1 Aug 2022 13:50:52 +0000 (GMT)	[thread overview]
Message-ID: <> (raw);h=7187efd0aa270c83c428ea6cd0e1cffc34b41a74

commit 7187efd0aa270c83c428ea6cd0e1cffc34b41a74
Author: Florian Weimer <>
Date:   Mon Aug 1 15:49:07 2022 +0200

    malloc: Use __getrandom_nocancel during tcache initiailization
    Cancellation currently cannot happen at this point because dlopen
    as used by the unwind link always performs additional allocations
    for, even if it has been loaded already as a dependency
    of the main executable.  But it seems prudent not to rely on this
    Reviewed-by: Adhemerval Zanella  <>

 malloc/malloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index bd3c76ed31..430d204156 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -254,6 +254,7 @@
 /* For tcache double-free check.  */
 #include <random-bits.h>
 #include <sys/random.h>
+#include <not-cancel.h>
@@ -3153,7 +3154,7 @@ static uintptr_t tcache_key;
 static void
 tcache_key_initialize (void)
-  if (__getrandom (&tcache_key, sizeof(tcache_key), GRND_NONBLOCK)
+  if (__getrandom_nocancel (&tcache_key, sizeof(tcache_key), GRND_NONBLOCK)
       != sizeof (tcache_key))
       tcache_key = random_bits ();

                 reply	other threads:[~2022-08-01 13:50 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:

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

  git send-email \ \ \ \

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