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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57782C6FA86 for ; Tue, 27 Sep 2022 08:30:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE3E88E00B8; Tue, 27 Sep 2022 04:30:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A935C8E00AF; Tue, 27 Sep 2022 04:30:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95C618E00B8; Tue, 27 Sep 2022 04:30:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 868CA8E00AF for ; Tue, 27 Sep 2022 04:30:42 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 36E1BC0DA2 for ; Tue, 27 Sep 2022 08:30:42 +0000 (UTC) X-FDA: 79957194324.08.726CAD1 Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by imf18.hostedemail.com (Postfix) with ESMTP id 992F31C000A for ; Tue, 27 Sep 2022 08:30:41 +0000 (UTC) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id 38C19201335; Tue, 27 Sep 2022 08:30:39 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id 8A4968052E; Tue, 27 Sep 2022 10:30:22 +0200 (CEST) Date: Tue, 27 Sep 2022 10:30:22 +0200 From: Dominik Brodowski To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, Kees Cook , Andrew Morton , stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] random: split initialization into early step and later step Message-ID: References: <20220926213130.1508261-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; spf=none (imf18.hostedemail.com: domain of linux@dominikbrodowski.net has no SPF policy when checking 136.243.71.142) smtp.mailfrom=linux@dominikbrodowski.net; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664267441; a=rsa-sha256; cv=none; b=mciJJfpWSWc639CLiTiTxMwQ5IlnPqaqW5wR6KouzH2B+n0/zBWoT+GqOUT7O00VpcL04k fJybBT8oSvaHjw+YIeXZaahtrgDr1kn8hObzPVw6UcxKwmU17FFtUzwjYfodtvhLWPmJIz 5I0y7xSJi7iiSWlglw4gbQnApW4ss+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664267441; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HQirqvyR11JUrFWBiZTkWi870cgxn67Y2EKlmqXlH+c=; b=fgk5Y/Cb2dE4iOcvMi1SMQB6Qa3s56+l7XbHWoZEjkvtE1+qoEvK6t3h1xYaXCrZpZTKqu LlURSWnHY9O35fL41aeHp0ASC/vYJEcnsaR9UIONa6B2cAgfTJ3vl9mcVzDeqrtiuEV6pc xpz9ruwZ2UYX+/U2bUP8/OQ11KEBSnM= X-Stat-Signature: 7u7bgshb33t3xdz84te9uc8s8ej6xfac X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 992F31C000A Authentication-Results: imf18.hostedemail.com; dkim=none; spf=none (imf18.hostedemail.com: domain of linux@dominikbrodowski.net has no SPF policy when checking 136.243.71.142) smtp.mailfrom=linux@dominikbrodowski.net; dmarc=none X-HE-Tag: 1664267441-165831 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Am Tue, Sep 27, 2022 at 10:28:11AM +0200 schrieb Jason A. Donenfeld: > On Tue, Sep 27, 2022 at 8:35 AM Dominik Brodowski > wrote: > > > #if defined(LATENT_ENTROPY_PLUGIN) > > > static const u8 compiletime_seed[BLAKE2S_BLOCK_SIZE] __initconst __latent_entropy; > > > @@ -803,34 +798,46 @@ int __init random_init(const char *command_line) > > > i += longs; > > > continue; > > > } > > > - entropy[0] = random_get_entropy(); > > > - _mix_pool_bytes(entropy, sizeof(*entropy)); > > > arch_bits -= sizeof(*entropy) * 8; > > > ++i; > > > } > > > > > > Previously, random_get_entropy() was mixed into the pool ARRAY_SIZE(entropy) > > times. > > > > > +/* > > > + * This is called a little bit after the prior function, and now there is > > > + * access to timestamps counters. Interrupts are not yet enabled. > > > + */ > > > +void __init random_init(void) > > > +{ > > > + unsigned long entropy = random_get_entropy(); > > > + ktime_t now = ktime_get_real(); > > > + > > > + _mix_pool_bytes(utsname(), sizeof(*(utsname()))); > > > > But now, it's only mixed into the pool once. Is this change on purpose? > > Yea, it is. I don't think it's really doing much of use. Before we did > it because it was convenient -- because we simply could. But in > reality mostly what we care about is capturing when it gets to that > point in the execution. For jitter, the actual jitter function > (try_to_generate_entropy()) is better here. > > However, before feeling too sad about it, remember that > extract_entropy() is still filling a block with rdtsc when rdrand > fails, the same way as this function was. So it's still in there > anyway. With that explanation on the record (I think it's important to make such subtle changes explicit), Reviewed-by: Dominik Brodowski Thanks, Dominik