Patch "random: add a config option to trust the CPU's hwrng" 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: add a config option to trust the CPU's hwrng

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-add-a-config-option-to-trust-the-cpu-s-hwrng.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: Theodore Ts'o <tytso@xxxxxxx>
Date: Tue, 17 Jul 2018 18:24:27 -0400
Subject: random: add a config option to trust the CPU's hwrng

From: Theodore Ts'o <tytso@xxxxxxx>

commit 39a8883a2b989d1d21bd8dd99f5557f0c5e89694 upstream.

This gives the user building their own kernel (or a Linux
distribution) the option of deciding whether or not to trust the CPU's
hardware random number generator (e.g., RDRAND for x86 CPU's) as being
correctly implemented and not having a back door introduced (perhaps
courtesy of a Nation State's law enforcement or intelligence
agencies).

This will prevent getrandom(2) from blocking, if there is a
willingness to trust the CPU manufacturer.

Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/char/Kconfig  |   14 ++++++++++++++
 drivers/char/random.c |   11 ++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -590,3 +590,17 @@ source "drivers/char/xillybus/Kconfig"
 
 endmenu
 
+config RANDOM_TRUST_CPU
+	bool "Trust the CPU manufacturer to initialize Linux's CRNG"
+	depends on X86 || S390 || PPC
+	default n
+	help
+	Assume that CPU manufacturer (e.g., Intel or AMD for RDSEED or
+	RDRAND, IBM for the S390 and Power PC architectures) is trustworthy
+	for the purposes of initializing Linux's CRNG.  Since this is not
+	something that can be independently audited, this amounts to trusting
+	that CPU manufacturer (perhaps with the insistence or mandate
+	of a Nation State's intelligence or law enforcement agencies)
+	has not installed a hidden back door to compromise the CPU's
+	random number generation facilities.
+
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -782,6 +782,7 @@ static void invalidate_batched_entropy(v
 static void crng_initialize(struct crng_state *crng)
 {
 	int		i;
+	int		arch_init = 1;
 	unsigned long	rv;
 
 	memcpy(&crng->state[0], "expand 32-byte k", 16);
@@ -792,10 +793,18 @@ static void crng_initialize(struct crng_
 		_get_random_bytes(&crng->state[4], sizeof(__u32) * 12);
 	for (i = 4; i < 16; i++) {
 		if (!arch_get_random_seed_long(&rv) &&
-		    !arch_get_random_long(&rv))
+		    !arch_get_random_long(&rv)) {
 			rv = random_get_entropy();
+			arch_init = 0;
+		}
 		crng->state[i] ^= rv;
 	}
+#ifdef CONFIG_RANDOM_TRUST_CPU
+	if (arch_init) {
+		crng_init = 2;
+		pr_notice("random: crng done (trusting CPU's manufacturer)\n");
+	}
+#endif
 	crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
 }
 


Patches currently in stable-queue which might be from tytso@xxxxxxx are

queue-4.14/random-remove-kernel.random.read_wakeup_threshold.patch
queue-4.14/random-introduce-drain_entropy-helper-to-declutter-crng_reseed.patch
queue-4.14/random-group-userspace-read-write-functions.patch
queue-4.14/drivers-char-random.c-make-primary_crng-static.patch
queue-4.14/crypto-chacha20-fix-chacha20_block-keystream-alignment-again.patch
queue-4.14/random-always-fill-buffer-in-get_random_bytes_wait.patch
queue-4.14/random-split-primary-secondary-crng-init-paths.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/drivers-char-random.c-remove-unused-stuct-poolinfo-poolbits.patch
queue-4.14/random-use-blake2s-instead-of-sha1-in-extraction.patch
queue-4.14/random-make-cpu-trust-a-boot-parameter.patch
queue-4.14/random-initialize-chacha20-constants-with-correct-endianness.patch
queue-4.14/random-group-entropy-extraction-functions.patch
queue-4.14/random-optimize-add_interrupt_randomness.patch
queue-4.14/random-add-proper-spdx-header.patch
queue-4.14/linux-random.h-remove-arch_has_random-arch_has_random_seed.patch
queue-4.14/random-rewrite-header-introductory-comment.patch
queue-4.14/random-make-dev-random-be-almost-like-dev-urandom.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/powerpc-remove-arch_has_random-arch_has_random_seed.patch
queue-4.14/fdt-add-support-for-rng-seed.patch
queue-4.14/random-add-arch_get_random_-long_early.patch
queue-4.14/random-inline-leaves-of-rand_initialize.patch
queue-4.14/random-replace-custom-notifier-chain-with-standard-one.patch
queue-4.14/random-document-get_random_int-family.patch
queue-4.14/random-remove-the-blocking-pool.patch
queue-4.14/random-avoid-warnings-for-config_numa-builds.patch
queue-4.14/random-ignore-grnd_random-in-getentropy-2.patch
queue-4.14/random-clear-fast-pool-crng-and-batches-in-cpuhp-bring-up.patch
queue-4.14/random-fix-typo-in-add_timer_randomness.patch
queue-4.14/random-do-crng-pre-init-loading-in-worker-rather-than-irq.patch
queue-4.14/powerpc-use-bool-in-archrandom.h.patch
queue-4.14/timekeeping-add-raw-clock-fallback-for-random_get_entropy.patch
queue-4.14/random-delete-code-to-pull-data-into-pools.patch
queue-4.14/random-simplify-entropy-debiting.patch
queue-4.14/random-use-siphash-as-interrupt-entropy-accumulator.patch
queue-4.14/random-fix-soft-lockup-when-trying-to-read-from-an-uninitialized-blocking-pool.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-check-for-signals-every-page_size-chunk-of-dev-random.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-use-rdseed-instead-of-rdrand-in-entropy-extraction.patch
queue-4.14/random-move-rand_initialize-earlier.patch
queue-4.14/random-don-t-wake-crng_init_wait-when-crng_init-1.patch
queue-4.14/random-add-a-urandom_read_nowait-for-random-apis-that-don-t-warn.patch
queue-4.14/random-remove-dead-code-left-over-from-blocking-pool.patch
queue-4.14/drivers-char-random.c-constify-poolinfo_table.patch
queue-4.14/random-use-computational-hash-for-entropy-extraction.patch
queue-4.14/random-add-and-use-pr_fmt.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/s390-remove-arch_has_random-arch_has_random_seed.patch
queue-4.14/random-do-not-xor-rdrand-when-writing-into-dev-random.patch
queue-4.14/random-convert-to-entropy_bits-for-better-code-readability.patch
queue-4.14/random-unify-cycles_t-and-jiffies-usage-and-types.patch
queue-4.14/random-insist-on-random_get_entropy-existing-in-order-to-simplify.patch
queue-4.14/random-group-initialization-wait-functions.patch
queue-4.14/linux-random.h-mark-config_arch_random-functions-__must_check.patch
queue-4.14/random-remove-unused-tracepoints.patch
queue-4.14/random-only-read-from-dev-random-after-its-pool-has-received-128-bits.patch
queue-4.14/random-try-to-actively-add-entropy-rather-than-passively-wait-for-it.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-add-grnd_insecure-to-return-best-effort-non-cryptographic-bytes.patch
queue-4.14/random-fix-whitespace-pre-random-bytes-work.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-add-a-config-option-to-trust-the-cpu-s-hwrng.patch
queue-4.14/random-remove-unnecessary-unlikely.patch
queue-4.14/random-defer-fast-pool-mixing-to-worker.patch
queue-4.14/random-use-static-branch-for-crng_ready.patch
queue-4.14/drivers-char-random.c-remove-unused-dont_count_entropy.patch
queue-4.14/random-group-entropy-collection-functions.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/linux-random.h-use-false-with-bool.patch
queue-4.14/maintainers-co-maintain-random.c.patch
queue-4.14/random-remove-outdated-int_max-6-check-in-urandom_read.patch
queue-4.14/random-remove-some-dead-code-of-poolinfo.patch
queue-4.14/random-do-not-use-batches-when-crng_ready.patch
queue-4.14/random-do-not-pretend-to-handle-premature-next-security-model.patch
queue-4.14/random-make-crng-state-queryable.patch
queue-4.14/random-avoid-superfluous-call-to-rdrand-in-crng-extraction.patch
queue-4.14/random-reseed-more-often-immediately-after-booting.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-do-not-use-input-pool-from-hard-irqs.patch
queue-4.14/random-return-nbytes-filled-from-hw-rng.patch
queue-4.14/char-random-silence-a-lockdep-splat-with-printk.patch
queue-4.14/random-do-not-allow-user-to-keep-crng-key-around-on-stack.patch
queue-4.14/x86-remove-arch_has_random-arch_has_random_seed.patch
queue-4.14/random-remove-ratelimiting-for-in-kernel-unseeded-randomness.patch
queue-4.14/random-use-hash-function-for-crng_slow_load.patch
queue-4.14/random-remove-preempt-disabled-region.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