aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/random.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-07-13 01:12:21 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2022-07-18 15:04:04 +0200
commit0b9ba6135d7f18b82f3d8bebb55ded725ba88e0e (patch)
tree66de7e09bef6d6693e35e8f50446ae8e2ed01267 /include/linux/random.h
parentrandom: use try_cmpxchg in _credit_init_bits (diff)
downloadlinux-dev-0b9ba6135d7f18b82f3d8bebb55ded725ba88e0e.tar.xz
linux-dev-0b9ba6135d7f18b82f3d8bebb55ded725ba88e0e.zip
um: seed rng using host OS rng
UML generally does not provide access to special CPU instructions like RDRAND, and execution tends to be rather deterministic, with no real hardware interrupts, making good randomness really very hard, if not all together impossible. Not only is this a security eyebrow raiser, but it's also quite annoying when trying to do various pieces of UML-based automation that takes a long time to boot, if ever. Fix this by trivially calling getrandom() in the host and using that seed as "bootloader randomness", which initializes the rng immediately at UML boot. The old behavior can be restored the same way as on any other arch, by way of CONFIG_TRUST_BOOTLOADER_RANDOMNESS=n or random.trust_bootloader=0. So seen from that perspective, this just makes UML act like other archs, which is positive in its own right. Additionally, wire up arch_get_random_{int,long}() in the same way, so that reseeds can also make use of the host RNG, controllable by CONFIG_TRUST_CPU_RANDOMNESS and random.trust_cpu, per usual. Cc: stable@vger.kernel.org Acked-by: Johannes Berg <johannes@sipsolutions.net> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'include/linux/random.h')
0 files changed, 0 insertions, 0 deletions