Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6136392iog; Thu, 23 Jun 2022 12:06:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vlLq0HcryqOZNKfCA5xjhP2QfNmmV560jtim71UWpR768Ye5MSbynWbNBqwWvm7aVa7YdL X-Received: by 2002:a05:6402:440f:b0:435:2e63:aca9 with SMTP id y15-20020a056402440f00b004352e63aca9mr12907469eda.162.1656011190158; Thu, 23 Jun 2022 12:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011190; cv=none; d=google.com; s=arc-20160816; b=okDE0qFhDIMKeDYlEDraS6/IBM1z+rDW86yS1gqb6WEvvk0sqpPM3p9C4F4fIm0Ula RavM8A9Yz0eUuyJgzLnYJhOHrXDbGKPGUANbT/Ejsb86zaolNwR2X15+JNueP1m7wdkg g13vv+0Pts4AX2YO+apF4fWn6EWkWS7MfO/amgxd5PevpNgCAlaW48APDFNcxw464TXH 5OMPTiU6EeyDnMp2d4aVQ+8kBtvDe0bmLwaNeQWJG+vi/SuuUtzME770aVT2Z+n72nkK VN1vSGAtvUPLRJgUVLhqO5ouf8BIbgwY/CQrdsJwK6Y9VqyZBjxg/sIuMpcK1PZRUa4/ wcCw== 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=tHivh72g9DIUqKELYPwUhn1iTbJnHaPddR+BpRzgjtM=; b=PJ2bju9+qYJUgNG1r9DmphbVpBr7P5Mv76vrb+3LG0eXkomX7/gsItzG7KybuBfY3e /Hcn/9qb3bisG7R6HumOGjQqnCThV4GMiaeCRVUzI8qRlCbvuj0WCGkBphjI8kjFinN/ Qlmgb0aBEEQVNZ1AM6qEejOSjFOXcID9h5qustKb+7CeVhs7bL/y5NoWUaBkdfzAUn2W nM6EPLPh9m4f6K5NkMU9XqlbOXDMzbbRrz8jz7QEPOzKBdDwEXnB1UKaUOcL6I3dqtsJ WktBGMTRx552cbq7zFcqyAm1f4vNaGQqIOL6lmPujWo9jgDKOVaQLBYlUd0aAX5s22II 1Hyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MRvCQv8k; 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 r16-20020a05640251d000b0042dc982357fsi489085edd.156.2022.06.23.12.06.04; Thu, 23 Jun 2022 12:06:30 -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=MRvCQv8k; 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 S231719AbiFWQ7z (ORCPT + 99 others); Thu, 23 Jun 2022 12:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbiFWQuI (ORCPT ); Thu, 23 Jun 2022 12:50:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0B84DF5B; Thu, 23 Jun 2022 09:48:12 -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 5237D61F90; Thu, 23 Jun 2022 16:48:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AAC4C3411B; Thu, 23 Jun 2022 16:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656002891; bh=zD09cKakxyc3Nute1Hje+iLEyQPhKu3WVzglRNiepPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRvCQv8ksts0XNmSWbF2HUE1ZPajiywkA/SwSOW/X14xtiVfDSpsV0oYlxfaMtroH Z/JdGFdfGsUa8rYCVHXPdsh1fF7wwQxSnRJEMJAJNTHMNSx3Zkdzjxpmi1Xy35yZPh YxaNHTlS5/792Eb9sP6wZhaHyTmiFVODO8HKfWR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Theodore Tso , "Jason A. Donenfeld" Subject: [PATCH 4.9 060/264] random: delete code to pull data into pools Date: Thu, 23 Jun 2022 18:40:53 +0200 Message-Id: <20220623164345.771109315@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: Andy Lutomirski commit 84df7cdfbb215a34657b39f4257dab739efa2df9 upstream. There is no pool that pulls, so it was just dead code. Signed-off-by: Andy Lutomirski Link: https://lore.kernel.org/r/4a05fe0c7a5c831389ef4aea51d24528ac8682c7.1577088521.git.luto@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -531,10 +531,8 @@ struct entropy_store { const struct poolinfo *poolinfo; __u32 *pool; const char *name; - struct entropy_store *pull; /* read-write data: */ - unsigned long last_pulled; spinlock_t lock; unsigned short add_ptr; unsigned short input_rotate; @@ -1416,41 +1414,6 @@ EXPORT_SYMBOL_GPL(add_disk_randomness); *********************************************************************/ /* - * This utility inline function is responsible for transferring entropy - * from the primary pool to the secondary extraction pool. We make - * sure we pull enough for a 'catastrophic reseed'. - */ -static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes); -static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes) -{ - if (!r->pull || - r->entropy_count >= (nbytes << (ENTROPY_SHIFT + 3)) || - r->entropy_count > r->poolinfo->poolfracbits) - return; - - _xfer_secondary_pool(r, nbytes); -} - -static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes) -{ - __u32 tmp[OUTPUT_POOL_WORDS]; - - int bytes = nbytes; - - /* pull at least as much as a wakeup */ - bytes = max_t(int, bytes, random_read_wakeup_bits / 8); - /* but never more than the buffer size */ - bytes = min_t(int, bytes, sizeof(tmp)); - - trace_xfer_secondary_pool(r->name, bytes * 8, nbytes * 8, - ENTROPY_BITS(r), ENTROPY_BITS(r->pull)); - bytes = extract_entropy(r->pull, tmp, bytes, - random_read_wakeup_bits / 8, 0); - mix_pool_bytes(r, tmp, bytes); - credit_entropy_bits(r, bytes*8); -} - -/* * This function decides how many bytes to actually take from the * given pool, and also debits the entropy count accordingly. */ @@ -1613,7 +1576,6 @@ static ssize_t extract_entropy(struct en spin_unlock_irqrestore(&r->lock, flags); trace_extract_entropy(r->name, EXTRACT_SIZE, ENTROPY_BITS(r), _RET_IP_); - xfer_secondary_pool(r, EXTRACT_SIZE); extract_buf(r, tmp); spin_lock_irqsave(&r->lock, flags); memcpy(r->last_data, tmp, EXTRACT_SIZE); @@ -1622,7 +1584,6 @@ static ssize_t extract_entropy(struct en } trace_extract_entropy(r->name, nbytes, ENTROPY_BITS(r), _RET_IP_); - xfer_secondary_pool(r, nbytes); nbytes = account(r, nbytes, min, reserved); return _extract_entropy(r, buf, nbytes, fips_enabled); @@ -1833,7 +1794,6 @@ static void __init init_std_data(struct ktime_t now = ktime_get_real(); unsigned long rv; - r->last_pulled = jiffies; mix_pool_bytes(r, &now, sizeof(now)); for (i = r->poolinfo->poolbytes; i > 0; i -= sizeof(rv)) { if (!arch_get_random_seed_long(&rv) &&