From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp4-g21.free.fr (smtp4-g21.free.fr [212.27.42.4]) by sourceware.org (Postfix) with ESMTPS id 411443857C49 for ; Tue, 2 Aug 2022 09:04:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 411443857C49 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=opteya.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=opteya.com Received: from [IPV6:2a01:e35:39f2:1220:64a3:f5aa:b8a4:1c4d] (unknown [IPv6:2a01:e35:39f2:1220:64a3:f5aa:b8a4:1c4d]) by smtp4-g21.free.fr (Postfix) with ESMTPS id B585619F742; Tue, 2 Aug 2022 11:04:25 +0200 (CEST) Message-ID: <2cce82a8-5a6c-f555-4592-1fae54dc2d0e@opteya.com> Date: Tue, 2 Aug 2022 11:04:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Using arc4random() in the library (was Re: [PATCH] malloc: Use __getrandom_nocancel during tcache initiailization) Content-Language: fr-FR To: libc-alpha@sourceware.org References: <87fsigp7y9.fsf@oldenburg.str.redhat.com> From: Yann Droneaud Organization: OPTEYA In-Reply-To: <87fsigp7y9.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2022 09:04:30 -0000 Hi, Le 01/08/2022 à 12:35, Florian Weimer via Libc-alpha a écrit : > 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. > > --- > 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 > #include > +#include > > /* > Debugging: > @@ -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) Is this a place where arc4random() could be used in the future ? aka. is there a policy on using arc4random() instead of getrandom() in the library ? -- Yann Droneaud OPTEYA