Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2600288imi; Mon, 25 Jul 2022 03:09:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tWy4aXZMsXh9m9IV3YR2QssF+v5loC98s0oQ0vM95QoBuQV7k96yBApiU27J0FziBU4sle X-Received: by 2002:a63:b443:0:b0:40c:fbf9:8366 with SMTP id n3-20020a63b443000000b0040cfbf98366mr10271310pgu.308.1658743773008; Mon, 25 Jul 2022 03:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658743773; cv=none; d=google.com; s=arc-20160816; b=Ce2VofA5wJdZy2N9NFFUhww3srMb5DaCmP8Pp3upLiCD24ebYdxlWOe1owiLmoJYa0 qf38dZn60urDt/OPwlczkWYcGVSJwx9cfs2cc7KWrgxwIQoGkZsJFv30oaSAE8+PFHoG qdJI1h9pVLuMe6klSji/ROxXVi/2vaXp/Hh5ZW6C4JiBOvkzSJv6w6ujGg0+bYcDy/lM otCMYDn/Gy+x/PmncbGOWx86MwaxsrURHdveQkuCPWEsJlhYCABcauUe1cYbI78VEvkD C8uKFT8HDAqNtNktmUwd54p/CpwcSlH9d67iHBOXV4O6kjWHmg9UlKlVvHIuE7qT4O0S uONg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3cUpfZrsKgEGJdkkpFrCNXEnszi93Av4FpAsIC0uCa0=; b=hrOicL3WMJpGxqMitA99Wl6fTWBmJpEd1iE6xWVr6l3ahBgVq5XzorJfzGDmqXwktg gE6l4gO4VVrc0ps5JbXnquETSrloX37yuzMY4WDVEN1xsTJJUutnuRqsp7dNaiqAWm5a NUBakt/yZxVTo8nALow3w57DnbQKItZlQG+PePop7zOy407QecHsGnutWM3j+47n8ez2 7m3OOq2d44hMqKhlwiz8AS7JHG1KSLiJTRRhJtc/Qr4iRiUPpOjTggEIPnhOIa8W/IcH nOrTZoCrDkZjkSn5AFx6I2o8b1hhRbuB8nSlBVq+8C4K5O6X7VV41fh0v11KAbK6TZ7i 15rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=SpfiMXzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170902f68400b0016c3d9ae25esi1075516plg.20.2022.07.25.03.09.14; Mon, 25 Jul 2022 03:09:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=SpfiMXzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234093AbiGYJhq (ORCPT + 99 others); Mon, 25 Jul 2022 05:37:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234054AbiGYJhm (ORCPT ); Mon, 25 Jul 2022 05:37:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDD9DF1A; Mon, 25 Jul 2022 02:37:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4890AB80E2A; Mon, 25 Jul 2022 09:37:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95483C341D6; Mon, 25 Jul 2022 09:37:38 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="SpfiMXzU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1658741856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3cUpfZrsKgEGJdkkpFrCNXEnszi93Av4FpAsIC0uCa0=; b=SpfiMXzUOpap0aBEfAfZZi7o1TEwaCATt4xLMdF0Zred+ymrbuL+5xvQwBCk/R+ObteizU ScP65Bn44eIbQOpKP6FA9erfr5zVNhclTelPIeQ09uYgfHkIibo7kdbhd/QmZgO51srDdk ROpeJfuW2p4cPnz4Ko230z76w+vfIPs= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 113134b8 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 25 Jul 2022 09:37:36 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id r3so19062561ybr.6; Mon, 25 Jul 2022 02:37:35 -0700 (PDT) X-Gm-Message-State: AJIora8/hepjbDyZqICPKVbO6bqpJZ1X0uZkhTB6eBs+0l7qQbavquB/ n9FPu8z1XHgzq5r27XNUjTU5LVGOBvgnmWaiJOw= X-Received: by 2002:a5b:70f:0:b0:670:7f57:e46b with SMTP id g15-20020a5b070f000000b006707f57e46bmr7841207ybq.24.1658741853953; Mon, 25 Jul 2022 02:37:33 -0700 (PDT) MIME-Version: 1.0 References: <20220719130207.147536-1-Jason@zx2c4.com> <10561a841a7342c882aabb0fbdbfc762@AcuMS.aculab.com> In-Reply-To: <10561a841a7342c882aabb0fbdbfc762@AcuMS.aculab.com> From: "Jason A. Donenfeld" Date: Mon, 25 Jul 2022 11:37:23 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] random: handle archrandom with multiple longs To: David Laight Cc: Borislav Petkov , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "x86@kernel.org" , Will Deacon , Alexander Gordeev , Thomas Gleixner , "H . Peter Anvin" , Catalin Marinas , Heiko Carstens , Johannes Berg , Mark Rutland , Harald Freudenberger , Michael Ellerman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 25, 2022 at 11:36 AM David Laight wrote: > > ... > > More directly, the reason we don't want to error is because the use case > > has fallbacks meant to handle errors. The cascade looks like this > > (quoting from the other email): > > > > unsigned long array[whatever]; > > for (i = 0; i < ARRAY_SIZE(array);) { > > longs = arch_get_random_seed_longs(&array[i], ARRAY_SIZE(array) - i); > > if (longs) { > > i += longs; > > continue; > > } > > longs = arch_get_random_longs(&array[i], ARRAY_SIZE(array) - i); > > if (longs) { > > i += longs; > > continue; > > } > > array[i++] = random_get_entropy(); > > } > > > > It tries to get the best that it can as much as it can, but isn't going > > to block or do anything too nuts for that. > > Do you really want to retry the earlier calls that returned no data? Does the above code do that?