mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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 libgcc_s.so.1, even if it has been loaded already as a dependency of the main executable. But it seems prudent not to rely on this quirk. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@ -254,6 +254,7 @@
|
|||||||
/* For tcache double-free check. */
|
/* For tcache double-free check. */
|
||||||
#include <random-bits.h>
|
#include <random-bits.h>
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
|
#include <not-cancel.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Debugging:
|
Debugging:
|
||||||
@ -3153,7 +3154,7 @@ static uintptr_t tcache_key;
|
|||||||
static void
|
static void
|
||||||
tcache_key_initialize (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))
|
!= sizeof (tcache_key))
|
||||||
{
|
{
|
||||||
tcache_key = random_bits ();
|
tcache_key = random_bits ();
|
||||||
|
Reference in New Issue
Block a user