From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id B580E3858D32 for ; Tue, 23 Aug 2022 07:19:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B580E3858D32 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQOCB-00034r-LO for libc-alpha@gnu.org; Tue, 23 Aug 2022 03:19:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-641--0ZReppuOwmkphWI4wERJg-1; Tue, 23 Aug 2022 03:19:29 -0400 X-MC-Unique: -0ZReppuOwmkphWI4wERJg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5DCD085A585; Tue, 23 Aug 2022 07:19:29 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A110D1121315; Tue, 23 Aug 2022 07:19:28 +0000 (UTC) From: Florian Weimer To: Paul Eggert Cc: libc-alpha@gnu.org Subject: Re: [PATCH 3/3] Merge tempname ASLR etc. patch from Gnulib References: <20220822205834.563590-1-eggert@cs.ucla.edu> <20220822205834.563590-3-eggert@cs.ucla.edu> Date: Tue, 23 Aug 2022 09:19:26 +0200 In-Reply-To: <20220822205834.563590-3-eggert@cs.ucla.edu> (Paul Eggert's message of "Mon, 22 Aug 2022 15:58:34 -0500") Message-ID: <875yij5sw1.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Received-SPF: pass client-ip=170.10.129.124; envelope-from=fweimer@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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, 23 Aug 2022 07:19:36 -0000 * Paul Eggert: > @@ -299,18 +325,16 @@ try_tempname_len (char *tmpl, int suffixlen, void *args, > { > if (vdigits == 0) > { > - do > - { > - v = random_bits (v, use_getrandom); > - use_getrandom = true; > - } > - while (unfair_min <= v); > + /* Worry about bias only if the bits are high quality. */ > + while (random_bits (&v, v) && biased_min <= v) > + continue; Should glibc simply use arc4random_uniform here? Thanks, Florian