On Sun, 2022-07-17 at 12:50 +0200, Jason A. Donenfeld wrote: > 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: sta...@vger.kernel.org > Cc: Johannes Berg <johan...@sipsolutions.net> > Acked-By: Anton Ivanov <anton.iva...@cambridgegreys.com> > Signed-off-by: Jason A. Donenfeld <ja...@zx2c4.com> > --- > Johannes - I need to take this through random.git, because it relies on > some other changes living there. Is that okay with you? -Jason
Sure, go ahead, thanks for doing this work! > Changes v3->v4: > - Don't include os.h, per Johannes' suggestion. Thanks. Acked-by: Johannes Berg <johan...@sipsolutions.net> johannes _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um