Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6145650iog; Thu, 23 Jun 2022 12:17:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u2QfB8PrTAeOsegxlMoyZBac0xYDmYWBTs2Ot4majhpe5hgpsj8mo0SinirN8zQ8mVPuIH X-Received: by 2002:a17:902:bf04:b0:168:f244:1f37 with SMTP id bi4-20020a170902bf0400b00168f2441f37mr41063140plb.106.1656011832811; Thu, 23 Jun 2022 12:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011832; cv=none; d=google.com; s=arc-20160816; b=dSKPw7UmMZBxj/q7uChTdEnWFZgCWOdyMYJzzLow9PjC5Luf4WXSo/HzJv0HQZtFL4 UtP3yW4u88a2IvFx4Sf+eyIb4I1ACnBbD9/PEnvOouq6PXhI4kLpvCcwfC0VbvEzBkB1 566hZqWjVIGYt0xzoYAZAYHj1ujj+Z03LT/wHh8HK9DGMjBwlOiY1RwtGOAdhPs6leRr ObgjqQx5kIcE+VvzkxWnn5HR/SOw0rEQ/wzMwZAU5dZzBUY6L77S10O/ZykjF0j+SM1a oR9RT0jO7dZ60P6mBVY3oqSjZhCJXVYsmlpxdETWA3jadV7bX+hgE4THCRHMFyNAKtIr LrmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PMxwT4H49lBgdOrZiCBrHLCTbE1wL6g+f2c2SUZj5j8=; b=T7jGFDPwT4jAJ15e0BhUnruUCiFFhOTUu/Z+ZVuHQfI92bVJN0j1L8M4DvMCgYiCcN hY++hxQUzyxa3zfahO6YNACqE3KWkPGHFpcxe4Bp/GYz3CTr7Ovau/VMaxeRMfuUdEBb LLc6HVlIv7WWz5rrE8uqMZunRbOIsJ1aHT1Kc3xIcsC7/rCAKyGbwyGqmb1O/fxNnM5s 0XUJ/kLmVRLrb50xk54ZgbkGDkSho966vK2KODKWT3wkQh8w7glg6J52RpPQNwvCaBgv hQ5DvKXDEnBfRjk/wAMGUpg/b6VBonr+J6ZNg8Y/ZPsHY2LPgyiNLuueqcNVJYkWxPZq SWuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="GV/yHYYV"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l192-20020a6391c9000000b003fdb58c86b4si583748pge.675.2022.06.23.12.17.00; Thu, 23 Jun 2022 12:17:12 -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=@linuxfoundation.org header.s=korg header.b="GV/yHYYV"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbiFWQwn (ORCPT + 99 others); Thu, 23 Jun 2022 12:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbiFWQwQ (ORCPT ); Thu, 23 Jun 2022 12:52:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8EE0C70; Thu, 23 Jun 2022 09:52:15 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6D48861FC2; Thu, 23 Jun 2022 16:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C645C3411B; Thu, 23 Jun 2022 16:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003134; bh=Ea2DuI5HzURpzZRy1dCo9khmXb8QqjZuhfPAQGahYm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GV/yHYYV3nP2t7RHJ3PxhF83CyBvGoazU6yG4NKFxdrMXx1HYdFChpcA79VMPfheF z83B9TC497kOhJp2u4ccJxkDbCey1KxnSRc1eBTQd96MYwlicE0eTSWI5PKBqZZyOj SAWLDXTXwqgCdXknrjC5yuxWIYiopGmlDFymnp6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Dominik Brodowski , "Jason A. Donenfeld" Subject: [PATCH 4.9 142/264] random: do not take pool spinlock at boot Date: Thu, 23 Jun 2022 18:42:15 +0200 Message-Id: <20220623164348.083875305@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Jason A. Donenfeld" commit afba0b80b977b2a8f16234f2acd982f82710ba33 upstream. Since rand_initialize() is run while interrupts are still off and nothing else is running, we don't need to repeatedly take and release the pool spinlock, especially in the RDSEED loop. Reviewed-by: Eric Biggers Reviewed-by: Dominik Brodowski Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -974,10 +974,10 @@ int __init rand_initialize(void) rv = random_get_entropy(); arch_init = false; } - mix_pool_bytes(&rv, sizeof(rv)); + _mix_pool_bytes(&rv, sizeof(rv)); } - mix_pool_bytes(&now, sizeof(now)); - mix_pool_bytes(utsname(), sizeof(*(utsname()))); + _mix_pool_bytes(&now, sizeof(now)); + _mix_pool_bytes(utsname(), sizeof(*(utsname()))); extract_entropy(base_crng.key, sizeof(base_crng.key)); ++base_crng.generation;