Patch "random: only call crng_finalize_init() for primary_crng" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    random: only call crng_finalize_init() for primary_crng

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     random-only-call-crng_finalize_init-for-primary_crng.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Thu Jun 16 07:08:33 PM CEST 2022
From: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 30 Jan 2022 22:03:20 +0100
Subject: random: only call crng_finalize_init() for primary_crng

From: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>

commit 9d5505f1eebeca778074a0260ed077fd85f8792c upstream.

crng_finalize_init() returns instantly if it is called for another pool
than primary_crng. The test whether crng_finalize_init() is still required
can be moved to the relevant caller in crng_reseed(), and
crng_need_final_init can be reset to false if crng_finalize_init() is
called with workqueues ready. Then, no previous callsite will call
crng_finalize_init() unless it is needed, and we can get rid of the
superfluous function parameter.

Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/char/random.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -799,10 +799,8 @@ static void __init crng_initialize_prima
 	primary_crng.init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
 }
 
-static void crng_finalize_init(struct crng_state *crng)
+static void crng_finalize_init(void)
 {
-	if (crng != &primary_crng || crng_init >= 2)
-		return;
 	if (!system_wq) {
 		/* We can't call numa_crng_init until we have workqueues,
 		 * so mark this for processing later. */
@@ -813,6 +811,7 @@ static void crng_finalize_init(struct cr
 	invalidate_batched_entropy();
 	numa_crng_init();
 	crng_init = 2;
+	crng_need_final_init = false;
 	process_random_ready_list();
 	wake_up_interruptible(&crng_init_wait);
 	kill_fasync(&fasync, SIGIO, POLL_IN);
@@ -979,7 +978,8 @@ static void crng_reseed(struct crng_stat
 	memzero_explicit(&buf, sizeof(buf));
 	WRITE_ONCE(crng->init_time, jiffies);
 	spin_unlock_irqrestore(&crng->lock, flags);
-	crng_finalize_init(crng);
+	if (crng == &primary_crng && crng_init < 2)
+		crng_finalize_init();
 }
 
 static void _extract_crng(struct crng_state *crng, u8 out[CHACHA20_BLOCK_SIZE])
@@ -1696,7 +1696,7 @@ int __init rand_initialize(void)
 {
 	init_std_data();
 	if (crng_need_final_init)
-		crng_finalize_init(&primary_crng);
+		crng_finalize_init();
 	crng_initialize_primary();
 	crng_global_init_time = jiffies;
 	if (ratelimit_disable) {


Patches currently in stable-queue which might be from linux@xxxxxxxxxxxxxxxxxxxx are

queue-4.14/random-do-not-take-pool-spinlock-at-boot.patch
queue-4.14/random-simplify-arithmetic-function-flow-in-account.patch
queue-4.14/random-introduce-drain_entropy-helper-to-declutter-crng_reseed.patch
queue-4.14/random-fix-locking-in-crng_fast_load.patch
queue-4.14/random-cleanup-uuid-handling.patch
queue-4.14/random-group-userspace-read-write-functions.patch
queue-4.14/random-make-credit_entropy_bits-always-safe.patch
queue-4.14/random-do-not-re-init-if-crng_reseed-completes-before-primary-init.patch
queue-4.14/random-pull-add_hwgenerator_randomness-declaration-into-random.h.patch
queue-4.14/random-unify-early-init-crng-load-accounting.patch
queue-4.14/random-remove-incomplete-last_data-logic.patch
queue-4.14/random-group-entropy-extraction-functions.patch
queue-4.14/random-add-proper-spdx-header.patch
queue-4.14/random-rewrite-header-introductory-comment.patch
queue-4.14/random-remove-ifdef-d-out-interrupt-bench.patch
queue-4.14/random-tie-batched-entropy-generation-to-base_crng-generation.patch
queue-4.14/random-use-linear-min-entropy-accumulation-crediting.patch
queue-4.14/random-remove-batched-entropy-locking.patch
queue-4.14/random-continually-use-hwgenerator-randomness.patch
queue-4.14/random-access-input_pool_data-directly-rather-than-through-pointer.patch
queue-4.14/random-inline-leaves-of-rand_initialize.patch
queue-4.14/random-cleanup-poolinfo-abstraction.patch
queue-4.14/random-handle-latent-entropy-and-command-line-from-random_init.patch
queue-4.14/random-credit-architectural-init-the-exact-amount.patch
queue-4.14/random-replace-custom-notifier-chain-with-standard-one.patch
queue-4.14/random-avoid-initializing-twice-in-credit-race.patch
queue-4.14/random-zero-buffer-after-reading-entropy-from-userspace.patch
queue-4.14/random-remove-whitespace-and-reorder-includes.patch
queue-4.14/random-clear-fast-pool-crng-and-batches-in-cpuhp-bring-up.patch
queue-4.14/random-do-crng-pre-init-loading-in-worker-rather-than-irq.patch
queue-4.14/random-early-initialization-of-chacha-constants.patch
queue-4.14/random-simplify-entropy-debiting.patch
queue-4.14/random-skip-fast_init-if-hwrng-provides-large-chunk-of-entropy.patch
queue-4.14/random-avoid-checking-crng_ready-twice-in-random_init.patch
queue-4.14/random-group-sysctl-functions.patch
queue-4.14/random-don-t-let-644-read-only-sysctls-be-written-to.patch
queue-4.14/random-only-wake-up-writers-after-zap-if-threshold-was-passed.patch
queue-4.14/random-check-for-signal-and-try-earlier-when-generating-entropy.patch
queue-4.14/random-absorb-fast-pool-into-input-pool-after-fast-load.patch
queue-4.14/random-give-sysctl_random_min_urandom_seed-a-more-sensible-value.patch
queue-4.14/random-cleanup-fractional-entropy-shift-constants.patch
queue-4.14/random-use-rdseed-instead-of-rdrand-in-entropy-extraction.patch
queue-4.14/random-move-initialization-functions-out-of-hot-pages.patch
queue-4.14/random-use-computational-hash-for-entropy-extraction.patch
queue-4.14/random-round-robin-registers-as-ulong-not-u32.patch
queue-4.14/random-always-wake-up-entropy-writers-after-extraction.patch
queue-4.14/random-do-not-xor-rdrand-when-writing-into-dev-random.patch
queue-4.14/random-only-call-crng_finalize_init-for-primary_crng.patch
queue-4.14/random-cleanup-integer-types.patch
queue-4.14/random-re-add-removed-comment-about-get_random_-u32-u64-reseeding.patch
queue-4.14/random-unify-cycles_t-and-jiffies-usage-and-types.patch
queue-4.14/random-group-initialization-wait-functions.patch
queue-4.14/random-remove-unused-extract_entropy-reserved-argument.patch
queue-4.14/random-access-primary_pool-directly-rather-than-through-pointer.patch
queue-4.14/random-remove-unused-tracepoints.patch
queue-4.14/random-treat-bootloader-trust-toggle-the-same-way-as-cpu-trust-toggle.patch
queue-4.14/random-make-consistent-usage-of-crng_ready.patch
queue-4.14/random-check-for-signals-after-page-of-pool-writes.patch
queue-4.14/random-make-random_get_entropy-return-an-unsigned-long.patch
queue-4.14/random-check-for-crng_init-0-in-add_device_randomness.patch
queue-4.14/random-defer-fast-pool-mixing-to-worker.patch
queue-4.14/random-harmonize-crng-init-done-messages.patch
queue-4.14/random-use-static-branch-for-crng_ready.patch
queue-4.14/random-rather-than-entropy_store-abstraction-use-global.patch
queue-4.14/random-group-entropy-collection-functions.patch
queue-4.14/random-de-duplicate-input_pool-constants.patch
queue-4.14/random-mix-build-time-latent-entropy-into-pool-at-init.patch
queue-4.14/random-remove-useless-header-comment.patch
queue-4.14/random-remove-outdated-int_max-6-check-in-urandom_read.patch
queue-4.14/random-mix-bootloader-randomness-into-pool.patch
queue-4.14/random-do-not-use-batches-when-crng_ready.patch
queue-4.14/random-use-is_enabled-config_numa-instead-of-ifdefs.patch
queue-4.14/random-use-symbolic-constants-for-crng_init-states.patch
queue-4.14/random-ensure-early-rdseed-goes-through-mixer-on-init.patch
queue-4.14/random-deobfuscate-irq-u32-u64-contributions.patch
queue-4.14/random-fix-crash-on-multiple-early-calls-to-add_bootloader_randomness.patch
queue-4.14/random-remove-ratelimiting-for-in-kernel-unseeded-randomness.patch
queue-4.14/random-prepend-remaining-pool-constants-with-pool_.patch
queue-4.14/random-remove-unused-output_pool-constants.patch
queue-4.14/random-use-hash-function-for-crng_slow_load.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux