5 ms·
Uniting the Linux random-number devices (2022)
- deleted 3y ago[deleted]
- soundarana 3y agoDoes Linux use the RNG inside Intel/AMD CPUs?
- goalieca 3y agoThe RDRAND instruction usage is configurable https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/kernel-parameters.txt#L5468 https://github.com/torvalds/linux/blob/master/Documentation/... edit: https://github.com/torvalds/linux/blob/55cb5f43689d7a9ea5bf35ef050f12334f197347/arch/x86/kernel/cpu/rdrand.c#L23 https://github.com/torvalds/linux/blob/55cb5f43689d7a9ea5bf3...
- oittaa 3y agoIf I remember correctly, the TLDR is that RDRAND output is mixed with other "standard" entropy sources and basically making getrandom() non-blocking immediately.
- bannee 3y ago[dead]
- binkHN 3y agoThis is from 2022.
- davikr 3y ago> The jitter entropy technique relies on differences in timing when running the same code, which requires both a high-resolution CPU cycle counter and a CPU that appears to be nondeterministic (due to caching, instruction reordering, speculation, and so on). There are some architectures that do not provide that, however, so no entropy can be gathered that way. Donenfeld noted that non-Amiga m68k systems, two MIPS models (R6000 and R6000A), and, possibly, RISC-V would be affected; So, I understand not wanting to break RISC-V support, but _should_ people really care about breaking compatibility with early 1990s MIPS chips and a 1979 Motorola CPU?
- phone8675309 3y agoClearly Linus and the maintainers of those architectures care enough not to break them (and those architecture maintainers have enough clout to be taken seriously). How old does a CPU need to be in order to no longer be supported? The 32-bit x86 architecture is nearly 40 years old - should it be retired for being too old?
- dspillett 3y ago> The 32-bit x86 architecture is nearly 40 years old - should it be retired for being too old? Parts of it already are, from a Linux point of view anyway. It looks like the mainline kernel will drop support for 486 family chips after 6.x, and support for the 386 was dropped in 3.8 (back in 2012). Some distributions already don't release a version for 32-bit-only intel/amd architectures. It'll be a long time before x86 support is dropped in its entirety, but even today you already have less choice than if you run something not sporting an amd64 or arm compatible architecture.
- jorvi 3y ago> The 32-bit x86 architecture is nearly 40 years old - should it be retired for being too old? I’m sure there is some way to gather architectural usage numbers + their likelihood of upgrading, roll it into a value, and if that value drops below X, that architecture gets left behind. The reason why I mention likelihood of upgrade is that there is a gigantic amount of MIPS routers running Linux, but virtually all of them are stuck on old kernels and very unlikely to be upgraded. I’m sure other architectures have similar snags.
- voakbasda 3y agoThey mostly run old kernels because their vendors do not keep them up to date, and the community does not have champions willing to upstream support for them. In theory it should still be entirely possible to refresh those devices with a modern kernel and user space. Patches would likely be welcomed upstream as well.
- pavon 3y ago
- rdtsc 3y agoThe commit [1] was eventually reverted [2] [1] https://github.com/torvalds/linux/commit/6f98a4bfee72c22f50aedb39fb761567969865fe https://github.com/torvalds/linux/commit/6f98a4bfee72c22f50a... [2] https://github.com/torvalds/linux/commit/0313bc278dac7cd9ce83a8d384581dc043156965 https://github.com/torvalds/linux/commit/0313bc278dac7cd9ce8... > "This causes a large number of qemu boot test failures for various architectures (arm, m68k, microblaze, sparc32, xtensa are the ones I observed). Common denominator is that boot hangs at 'Saving random seed:'" This isn't hugely unexpected - we tried it, it failed, so now we'll revert it.
- influx 3y agoThanks for this, I'd been going off the previous articles on this, and hadn't realized it had been reverted.
- rdtsc 3y agoNo problem. Thanks for finding and posting the article! The change was a good idea but like things happen, corner cases intervened.
- Denvercoder9 3y agoA bit later another commit [1] was merged that makes reads from /dev/urandom opportunistically initialize the RNG. In practice this has the same result as the reverted commit on non-obsolete architectures, which support the jitter entropy generation. [1] https://github.com/torvalds/linux/commit/48bff1053c172e6c7f340e506027d118147c8b7f https://github.com/torvalds/linux/commit/48bff1053c172e6c7f3...
- GoblinSlayer 3y agoOn demand initialization? What a surprise.
- minedwiz 3y ago`rdtsc`, you have a very appropriate username for the topic
- davidw 3y agoI'm imagining Kramer, Linux developer: "Jerry... what if we randomly used a different random device each time?!"
- EdSchouten 3y agoEven though not all architectures have an RTC or strong PRNG instructions, almost all of them have writable storage in the form of NVRAM/NAND/disk. Why can’t they just patch up the kernel to persist PRNG state there and require that the boot loader recovers it upon reboot? The kernel would then have high quality random data available as soon as it gets launched.
- kurikuri 3y agoThe PRNG state is responsible for generating most of the users cryptographic material and is quite important to the system’s security. As such, the PRNG State is a security parameter that should never be exportable nor importable. There are many new attacks that could surface if import/export were possible; off the top of my head: quiet preloading of an attacker-selected state while the machine is off.
- 1000thVisitor 3y ago> quiet preloading of an attacker-selected state while the machine is off. That attacker with physical access can chose from multiple other attacks, so why bother making this one more secure. They can sniff keyboard strokes, install malware into the UEFI, etc. pp.
- yencabulator 3y agoYou don't need to export the current running kernel PRNG internal state, all you need is to save an unpredictable seed that can be used to fill the kernel entropy pool after next boot. https://systemd.io/RANDOM_SEEDS/ https://systemd.io/RANDOM_SEEDS/
- Asmod4n 3y agoJust do what netbsd recommends and you should be fine https://man.netbsd.org/urandom.4 https://man.netbsd.org/urandom.4 They explicitly state you should dog feed the prng on every shutdown and boot and also explain why that isn’t an issue.
- GoblinSlayer 3y ago>quiet preloading Just preload the OS then.
- dataflow 3y agoWhat did Windows and Mac do a decade or two ago? What do they do now? Why do I only ever see Linux struggling with random numbers and booting here?
- deleted 3y ago[deleted]
- LtWorf 3y agoThey solve it by not supporting 99% of the hardware that linux supports.