[GIT PULL] random number generator fixes for 5.19-rc2

From: Jason A. Donenfeld
Date: Sat Jun 11 2022 - 11:36:42 EST


Hi Linus,

Please pull the following random number generator fixes for 5.19-rc2:

- A fix for a 5.19 regression for a case in which early device tree
initializes the RNG, which flips a static branch. On most plaforms, jump
labels aren't initialized until much later, so this caused splats. On a few
mailing list threads, we cooked up easy fixes for arm64, arm32, and risc-v.
But then things looked slightly more involved for xtensa, powerpc, arc, and
mips. And at that point, when we're patching 7 architectures in a place
before the console is even available, it seems like the cost/risk just
wasn't worth it. So random.c works around it now by checking the already
exported `static_key_initialized` boolean, as though somebody already ran
into this issue in the past. I'm not super jazzed about that; it'd be
prettier to not have to complicate downstream code. But I suppose it's
practical.

- A few small code nits and adding a missing __init annotation.

- A change to the default config values to use the cpu and bootloader's seeds
for initializing the RNG earlier. This brings them into line with what all
the distros do (Fedora/RHEL, Debian, Ubuntu, Gentoo, Arch, NixOS, Alpine,
SUSE, and Void... at least), and moreover will now give us test coverage in
various test beds that might have caught the above device tree bug earlier.

- A change to WireGuard CI's configuration to increase test coverage around
the RNG.

- A documentation comment fix to unrelated maintainerless CRC code that I was
asked to take, I guess because it has to do with polynomials (which the RNG
thankfully no longer uses).

Thanks,
Jason

The following changes since commit e71e60cd74df9386c3f684c54888f2367050b831:

Merge tag 'dma-mapping-5.19-2022-06-06' of git://git.infradead.org/users/hch/dma-mapping (2022-06-06 17:56:18 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git tags/random-5.19-rc2-for-linus

for you to fetch changes up to 17b0128a136d43e5f8f268631f48bc267373ebff:

wireguard: selftests: use maximum cpu features and allow rng seeding (2022-06-11 15:38:08 +0200)

----------------------------------------------------------------
Random number generator fixes for Linux 5.19-rc2.
----------------------------------------------------------------

Jason A. Donenfeld (7):
random: avoid checking crng_ready() twice in random_init()
random: mark bootloader randomness code as __init
random: account for arch randomness in bits
random: do not use jump labels before they are initialized
random: credit cpu and bootloader seeds by default
random: remove rng_has_arch_random()
wireguard: selftests: use maximum cpu features and allow rng seeding

Roger Knecht (1):
crc-itu-t: fix typo in CRC ITU-T polynomial comment

drivers/char/Kconfig | 50 ++++++++++++++--------
drivers/char/random.c | 39 ++++++++---------
include/linux/crc-itu-t.h | 2 +-
include/linux/random.h | 3 +-
lib/crc-itu-t.c | 2 +-
lib/vsprintf.c | 3 +-
tools/testing/selftests/wireguard/qemu/Makefile | 28 ++++++------
tools/testing/selftests/wireguard/qemu/init.c | 3 ++
.../testing/selftests/wireguard/qemu/kernel.config | 3 ++
9 files changed, 71 insertions(+), 62 deletions(-)