7 ms·
An interesting discussion in Linus's release announcement email about userspace regressions: https://lkml.org/lkml/2019/9/15/241 https://lkml.org/lkml/2019/9/15
by thestoicattack 7y ago
An interesting discussion in Linus's release announcement email about userspace regressions: https://lkml.org/lkml/2019/9/15/241 https://lkml.org/lkml/2019/9/15/241
- duckerude 7y agoMore technical details here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.3&id=72dbcf72156641fde4d8ea401e977341bfd35a05 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
- leni536 7y ago> The correct fix is to fix getrandom() to not block when it's not appropriate,... I'm not a cryptography expert, but this suggestion doesn't look right. Edit: IMO the main problem is the lack of a forward progress guarantee for entropy generation, even if there are suitable sources for entropy in the system.
- banachtarski 7y agoI've worked in crypto before (not now though) and your statement is actually a common misconception. The information about whether the randomness is sourced from "true" entropy or not is in and of itself a form of entropy from the perspective of an assailant. It's enough that given some period of time, "some" amount of entropy is present and how much is dependent on the degree to which the system is used. You can use a game theoretic approach to determine how much that is. edit: to clarify, occasionally not using /dev/random when it may block is not actually a security issue (in most cases)
- ses1984 7y agoHow do we know which cases?
- deleted 7y ago[deleted]
- masklinn 7y agoThe only case where it could be an issue is at bootup, when the subsystem simply does not have enough entropy. OpenBSD solved that by storing a seed for next bootup at the end of boot and during shutdown.
- simonh 7y agoI hope the seed is very well protected.
- VibrantClarity 7y agowdym? if an attacker can access your filesystem its already game over
- iforgotpassword 7y agoThe same could be said for some of the entropy sources that were nerfed or removed over time due to security concerns. That's the main reason why we even are in this situation today.
- asamarin 7y agoSo what happens at the very first boot (e.g. after system installation, or cloud instance just being spawned)? Is that the only circumstance where it would be OK to block? Does OpenBSD trust RdRand for such occasions?
- ChrisSD 7y agoYou can set /etc/random.seed (or /var/db/host.random for spawned instances) prior to first boot. That's what cloud providers do IIRC. It also mixes in hardware random (if available).
- 7y ago
- trasz 7y agoPRNG needs entropy, but it doesn't consume it. You don't need to feed entropy into it continuously.
- msla 7y ago> PRNG needs entropy, but it doesn't consume it. You don't need to feed entropy into it continuously. In the extreme case, this means you can run a PRNG with a fixed seed indefinitely, which is definitely wrong because such a PRNG will necessarily loop. That might not be feasible to exploit, however.
- stouset 7y ago> such a PRNG will necessarily loop Given infinite time, energy, and computing power, yes. Given computers made out matter and running on energy for use by meat-based intelligences, no. This is really analogous to saying "technically a 256-bit encryption key is brute-forceable". In fact, this is so close to being the actual underlying situation it's barely even an analogy.
- pmoriarty 7y agoSomething else I'd wonder is whether there are other sources of entropy that could be used here other than the disk -- as improving disk IO is what seems to have caused this particular issue in the first place.
- dmitrygr 7y ago> even if there are suitable sources for entropy in the system What might those be on, say, a freshly booted RasPi that hasn't even brought up much of userspace besides systemd?
- jlgaddis 7y agoThe Raspberry Pi has a HWRNG onboard.
- dmitrygr 7y agoDo you trust it?
- tatersolid 7y agoYou’re forced to trust the maker of your CPU, mainboard, etc. if you can’t trust your hardware you’re toast. There’s nothing special about RNGs in this regard.
- leni536 7y agoThe problematic commit reduced the number of disk IO at bootup which resulted in starving getrandom() from the necessary entropy. If disk IO is already considered a reliable source of entropy then there is no reason to not actively exercise it when entropy is needed.
- danieldk 7y agoAnd before people start bashing systemd, the cause for boot hangs was actually collection of randomness for a Xorg/Xwayland MIT cookie through gdm. So, Linus' e-mail linked by the parent is somewhat inaccurate. https://lore.kernel.org/linux-ext4/20190915081747.GA1058@darwi-home-pc/ https://lore.kernel.org/linux-ext4/20190915081747.GA1058@dar... https://lore.kernel.org/linux-ext4/20190916014050.GA7002@darwi-home-pc/ https://lore.kernel.org/linux-ext4/20190916014050.GA7002@dar...
- ldng 7y agoYet it is implicitly directed at Systemd that have not hesitate in the past to break userspace. More than once.
- devit 7y agoHmm, isn't the solution to do something proactively to increase entropy when getrandom() is waiting for it? (especially for the first bytes) Like inserting arbitrary reads of any available SSD or hard disk that has already been spun up, or something better if possible. And in newer userspace, just properly save and restore a seed.
- JoshTriplett 7y agoWhat does "arbitrary" mean if you don't have any randomness? Response times of devices are getting increasingly predictable.
- ryacko 7y agoThe timer entropy daemon has been around for a while. At minimum one has access to a hardware random number with an output of 256 bits per second by waiting for an interrupt from a timer.
- rHcsgjuuHw 7y ago> Do we just make it act like /dev/urandom by default, and add a new flag for "wait for entropy"? Dear God. The CSPRNG situation on Linux is deeply depressing. /dev/urandom is useless because it spews non-random data if it hasn't been seeded yet. /dev/random is useless because it starts blocking if you try to read too much data from it, because of a mistaken belief that a properly seeded CSPRNG can run out of entropy. Plus they're both slow as hell, so people try to implement their own PRNGs, often having bugs in the generator or seeding, leading to security issues. Meanwhile the BSDs have handled this correctly for years. But inexplicably, instead of actually fixing /dev/(u)random, the Linux engineers decide to add a new getrandom() syscall which implements the correct behaviour of only blocking if the PRNG hasn't been seeded. So finally with getrandom() Linux has a way to securely generate random data without unnecessarily blocking, and now Linus seems to be floating the idea to break it again! The kernel has plenty of ways to securely seed a PRNG at boot on modern systems; IRQ timings, multicore tricks, sensor data, etc. Run some statistical tests on it to ensure you have a couple hundred bits of randomness and you're done.
- xyzzyz 7y ago/dev/urandom is useless because it spews non-random data if it hasn't been seeded yet. Does it? Under what circumstances? Where can I read about it?
- yjftsjthsd-h 7y ago`man 4 random` states, > When read during early boot time, /dev/urandom may return data prior to the entropy pool being initialized. If this is of concern in your application, use getrandom(2) or /dev/random instead.
- CodeHz 7y agoit happened in my system in last boot, dmesg says dbus-daemon tried (twice!) to read urandom before its seeded, and the next message (same second, about 200ms) is about urandom has been seeded, it is a race condition!
- ploxiln 7y ago
- pedrocr 7y agoThere's a limit to how far you can go with that policy but it does seem that in this case the regression was fairly obvious. As always there's a xkcd about it: https://xkcd.com/1172/ https://xkcd.com/1172/
- dev_dull 7y agoWhat is with anything with the words “release notes” in the title being completely unreadable on a mobile device?
- new_realist 7y agoGreat; and while we’re reverting obvious breakages of userspace performance, perhaps Linus can also un-break ZFS SIMD.
- AstralStorm 7y agoZFS on Linux is neither mainline nor userspace. Feel free to either fix it or contact its maintainers. If they're lagging behind kernel versions, it's their fault.
- Topgamer7 7y agoLove the spelling joke in there.
- jjoonathan 7y agoOnly the finest speling will do for the LKML.