From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by sourceware.org (Postfix) with ESMTPS id 4221F3858D39 for ; Mon, 1 Aug 2022 13:42:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4221F3858D39 Received: by mail-vs1-xe2c.google.com with SMTP id x125so11229804vsb.13 for ; Mon, 01 Aug 2022 06:42:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:organization:in-reply-to :content-transfer-encoding; bh=C5rVQOxix5nHlVYy9cnDZ7J+rCahMI+JD8+2UufOFaY=; b=0Pl4NSBkN8pkT0WaykYRBwCAzxvBbWyGHO0SpsOgGi+RqDwpJkEX/aQZOBFUn2zgn0 NPE4QwuOdD+fJ4WrIxY1T4UGIsw2AfIpBHiyFrHfJ/ptGNU5joBD9NTntST0Mf/Cey1K yOIXusVCxFK73EF7jQy81r5n2iRWh9llaOTMeXRwGMOfURhBIa5oQ/DZLHMRpyn3apE6 YVan+NhKy/M9O3RHLYenTvmu9bqSPmeFAe8bK/GdRp6f5aShaYUdMMgoTKbFG/uiyQkC MAHFIZrfL+Y2WeWwqOBiZOg/OyJmX6jRusIa20kyOZnKDVSg7SOsFDXNBxFqPGnzfOVw aEFg== X-Gm-Message-State: ACgBeo39Mq5AEm6b9c3Uo0DnniNZtOVINk5gioKaBe8ggcbN07GYlYBV q35nSSnCk9zdD4Eui91EVsHW5A== X-Google-Smtp-Source: AA6agR5lg+YottNstbK8tI6C35A+ybHVbbrQqJEFGfcnvU6eenOgM5bmijXzwGLBcGTo5QFScVKSEQ== X-Received: by 2002:a67:de84:0:b0:385:5a6b:15ae with SMTP id r4-20020a67de84000000b003855a6b15aemr1607188vsk.2.1659361328549; Mon, 01 Aug 2022 06:42:08 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:1e34:d541:f280:24d8:b04c? ([2804:431:c7cb:1e34:d541:f280:24d8:b04c]) by smtp.gmail.com with ESMTPSA id w3-20020a1f9403000000b0035e9087e684sm5950532vkd.24.2022.08.01.06.42.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Aug 2022 06:42:08 -0700 (PDT) Message-ID: <90921f54-15b6-2d4c-42ca-a918df579d2d@linaro.org> Date: Mon, 1 Aug 2022 10:42:06 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCH] malloc: Use __getrandom_nocancel during tcache initiailization Content-Language: en-US To: Florian Weimer , libc-alpha@sourceware.org References: <87fsigp7y9.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <87fsigp7y9.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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: Mon, 01 Aug 2022 13:42:11 -0000 On 01/08/22 07:35, Florian Weimer via Libc-alpha wrote: > 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. > LGTM, thanks. 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 > #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) > != sizeof (tcache_key)) > { > tcache_key = random_bits (); >