From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99F9FC433EF for ; Fri, 5 Nov 2021 07:54:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8198E61265 for ; Fri, 5 Nov 2021 07:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232412AbhKEH4o (ORCPT ); Fri, 5 Nov 2021 03:56:44 -0400 Received: from isilmar-4.linta.de ([136.243.71.142]:37676 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbhKEH4j (ORCPT ); Fri, 5 Nov 2021 03:56:39 -0400 X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from light.dominikbrodowski.net (brodo.linta [10.2.0.102]) by isilmar-4.linta.de (Postfix) with ESMTPSA id CD9DE201340; Fri, 5 Nov 2021 07:53:57 +0000 (UTC) Received: by light.dominikbrodowski.net (Postfix, from userid 1000) id C6899204BC; Fri, 5 Nov 2021 07:04:39 +0100 (CET) Date: Fri, 5 Nov 2021 07:04:39 +0100 From: Dominik Brodowski To: Ard Biesheuvel Cc: "Theodore Y. Ts'o" , "Ivan T. Ivanov" , linux-efi , Linux Kernel Mailing List Subject: Re: [PATCH] random: fix crash on multiple early calls to add_bootloader_randomness() Message-ID: References: <20211012082708.121931-1-iivanov@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Wed, Nov 03, 2021 at 08:27:39AM +0100 schrieb Ard Biesheuvel: > > > > - if (unlikely(crng_init == 0)) { > > > > + /* We cannot do much with the input pool until it is set up in > > > > + * rand_initalize(); therefore just mix into the crng state. > > > > + * As this does not affect the input pool, we cannot credit > > > > + * entropy for this. > > > > + */ > > > > + if (unlikely(crng_init == 0) || unlikely(crng_global_init_time == 0)) { > > > > > > Can we just drop the unlikely()s here? > > > > As that would be a different change to the one necessary to resolve the bug, > > I'd like to defer that decision to the maintainer of random.c. > > > > In that case, can we at least using a single unlikely() for the whole condition? Fixed for v3. Thanks, Dominik