From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 70F8C3857C50 for ; Thu, 25 Mar 2021 11:58:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 70F8C3857C50 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-55-24XN9-YdNa2UgyFXXrdiuA-1; Thu, 25 Mar 2021 07:58:14 -0400 X-MC-Unique: 24XN9-YdNa2UgyFXXrdiuA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85546A0C22; Thu, 25 Mar 2021 11:57:44 +0000 (UTC) Received: from localhost (unknown [10.33.36.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14C9F2AE90; Thu, 25 Mar 2021 11:57:43 +0000 (UTC) Date: Thu, 25 Mar 2021 11:57:43 +0000 From: Jonathan Wakely To: Alexandre Oliva Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: require et random_device for cons token test Message-ID: <20210325115743.GM3008@redhat.com> References: <20210324085907.GD3008@redhat.com> <20210324112718.GF3008@redhat.com> <20210324140140.GH3008@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2021 11:58:19 -0000 On 25/03/21 07:17 -0300, Alexandre Oliva wrote: >On Mar 24, 2021, Jonathan Wakely wrote: > >> This works for me on x86_64-linux and powerpc64le-linux, and also on >> x86_64-linux when I kluge the config macros so that the new code path >> gets used. Does this work for VxWorks? > >Thanks. I (trivially) backported it to apply on our gcc-10 tree, and >tested that on x86_64-vx7r2, and I confirm it works there too. > >However, I suspect there's a series of typos in the patch. You appear >to be using the 'which' enum variable for bit testing, but with '|' >rather than '&'. Oops, that's what I get for a last-minute rewrite without proper testing. I originally had: if (which == blah || which == any) and then borked it in an attempt to use & instead. I'll fix that locally too. >Unless I'm missing something in my reading of the modified code, this >may cause a backend different from that requested by the token to be >selected, but it doesn't look like we have any test that detects this >problem. I don't see how it's possible to detect, without something like a modified system that replaces /dev/random with a non-random source so you can verify that std::random_device("/dev/random") and std::random_device("rdseed") don't use the same source. I suppose we could check the number of open file descriptors as a proxy for "something is reading /dev/random", but there's no way to check that std::random_device(tok1) and std::random_device(tok2) use different sources of randomness.