]> git.baikalelectronics.ru Git - kernel.git/commit
random: remove CONFIG_ARCH_RANDOM
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 5 Jul 2022 18:48:41 +0000 (20:48 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 18 Jul 2022 13:03:37 +0000 (15:03 +0200)
commit5d72a318be1c43a9e632c3361de364155f29e261
treec6342d647f5b03d9c2d5b4eca67e56e4af31aef4
parentd6ce4bf084c3e7ef70f782d6823a18a9097c930a
random: remove CONFIG_ARCH_RANDOM

When RDRAND was introduced, there was much discussion on whether it
should be trusted and how the kernel should handle that. Initially, two
mechanisms cropped up, CONFIG_ARCH_RANDOM, a compile time switch, and
"nordrand", a boot-time switch.

Later the thinking evolved. With a properly designed RNG, using RDRAND
values alone won't harm anything, even if the outputs are malicious.
Rather, the issue is whether those values are being *trusted* to be good
or not. And so a new set of options were introduced as the real
ones that people use -- CONFIG_RANDOM_TRUST_CPU and "random.trust_cpu".
With these options, RDRAND is used, but it's not always credited. So in
the worst case, it does nothing, and in the best case, maybe it helps.

Along the way, CONFIG_ARCH_RANDOM's meaning got sort of pulled into the
center and became something certain platforms force-select.

The old options don't really help with much, and it's a bit odd to have
special handling for these instructions when the kernel can deal fine
with the existence or untrusted existence or broken existence or
non-existence of that CPU capability.

Simplify the situation by removing CONFIG_ARCH_RANDOM and using the
ordinary asm-generic fallback pattern instead, keeping the two options
that are actually used. For now it leaves "nordrand" for now, as the
removal of that will take a different route.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
24 files changed:
arch/arm/include/asm/archrandom.h
arch/arm64/Kconfig
arch/arm64/include/asm/archrandom.h
arch/arm64/kernel/cpufeature.c
arch/powerpc/Kconfig
arch/powerpc/include/asm/archrandom.h
arch/powerpc/include/asm/machdep.h
arch/powerpc/platforms/microwatt/Kconfig
arch/powerpc/platforms/powernv/Kconfig
arch/powerpc/platforms/pseries/Kconfig
arch/s390/Kconfig
arch/s390/configs/zfcpdump_defconfig
arch/s390/crypto/Makefile
arch/s390/include/asm/archrandom.h
arch/s390/kernel/setup.c
arch/x86/Kconfig
arch/x86/include/asm/archrandom.h
arch/x86/kernel/cpu/rdrand.c
drivers/char/Kconfig
drivers/char/hw_random/s390-trng.c
include/asm-generic/Kbuild
include/asm-generic/archrandom.h [new file with mode: 0644]
include/linux/random.h
tools/testing/selftests/wireguard/qemu/kernel.config