Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6163462iog; Thu, 23 Jun 2022 12:41:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tBeuoQht+fZzuDXikkjMt+o+8hkaSfx8GjN8WzWBWYcb8AZnjCwzWSyIsW0rJIBLLBWULe X-Received: by 2002:a05:6402:3553:b0:434:ef34:664f with SMTP id f19-20020a056402355300b00434ef34664fmr7987911edd.236.1656013270094; Thu, 23 Jun 2022 12:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656013270; cv=none; d=google.com; s=arc-20160816; b=dsbvhBJvYfBEZed+avsug5eWFn4kPLDCk0taQqziMaK2HlVJBHjxc5EaO3WYUKvdjE 1I9DLnLiRQ0dONa846kJcbrpQmSwrYstZQSi73SuTRXMq1JskIVWBDHGV3lfdKVepLED sSEP70qpGIQSN/+UIpy28eaQjldlUKUAUL0tf0ekD/qLun8W91QrK2/WhnlGnqrSdze2 qta8EXsqHL001S2CJAjjAnYCNZrgP1VUgx93fqmXC16GwYW0uoKpZcv9jJoAhyCXykhO uwAyra3DUOvvKHri+lxR58eekVLqTJeIx4ZOzAYkRv3W39GRAVfTJLxwN/nvJAVmShlM 1OFQ== 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=DstGA8lC+CEC8LRcEX3lBRvFWbdpTjArHYDO+RcmSKc=; b=kqKuxwcYOZ5tvhL4NqEwJV6hLFIbr5p3ow8PoP1sSiQVlt5SFhazxaxz+Vtl3g9M3X cgxioa+q+iwi62MveSnuW3/ESgilxFW0yByRbUYbttYO6QEdIhb3D2YF0nHHTvikxQzD 10nfPR+bxM7c67ZtnAdRfEyIMp/sFpBXh/2aRfcal3zC2kkf8pG25tdSI3oJ3mGY17E7 FdrRnkLfboQMm8nPiNcZNp6vU+bQtXnx8B9CUHdG8BZbhLlgtb1EONvylrj48ZmjtKj8 t9JAGKzz9wV3vbb0wYYgwPjhiNMC4FeV22KJmJLNpTqCArcMFNoN3nV+LL8JdXB5aLZi Y18Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hfA2DsTR; 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 oz10-20020a1709077d8a00b006ff47214f59si8357647ejc.515.2022.06.23.12.40.44; Thu, 23 Jun 2022 12:41:10 -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=hfA2DsTR; 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 S234248AbiFWRcU (ORCPT + 99 others); Thu, 23 Jun 2022 13:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbiFWR3o (ORCPT ); Thu, 23 Jun 2022 13:29:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8BE7FD2A; Thu, 23 Jun 2022 10:04:49 -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 80BFFB82490; Thu, 23 Jun 2022 17:04:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE70DC3411B; Thu, 23 Jun 2022 17:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003888; bh=/S1iYXeszMNaRYv4XNqtEEGXovrfJyB6SAipvJMmfqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hfA2DsTRL8Fk8kefxOMCwzN8RWt4/cXVNshOn3vesj3Ep2q7OfXijw8l/3CZC3idr F0NPKZlapYMPhXGReghtyAJ+s9rTwgcmEjTK5qhVkUp8l8x1suXraRYQ2Kg4f0AUA2 Cx4Bm//5LjCWsWOAjDUGc+Ak8GmNv2QBGTd5Pwow= 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.14 119/237] random: do not take pool spinlock at boot Date: Thu, 23 Jun 2022 18:42:33 +0200 Message-Id: <20220623164346.578536073@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.132308638@linuxfoundation.org> References: <20220623164343.132308638@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 @@ -973,10 +973,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;