On Mo, 14.02.22 15:13, Jason A. Donenfeld (Jason@xxxxxxxxx) wrote: > Hi Lennart, > > On Mon, Feb 14, 2022 at 9:53 AM Lennart Poettering <mzxreary@xxxxxxxxxxx> wrote: > > So, systemd uses (potentially half-initialized) /dev/urandom for > > seeding its hash tables. For that its kinda OK if the random values > > have low entropy initially, as we'll automatically reseed when too > > many hash collisions happen, and then use a newer (and thus hopefully > > better) seed, again acquired through /dev/urandom. i.e. if the seeds > > are initially not good enough to thwart hash collision attacks, once > > the hash table are actually attacked we'll replace the seeds with > > someting better. For that all we need is that the random pool > > eventually gets better, that's all. > > > > So for that usecase /dev/urandom behaving the way it so far does is > > kinda nice. > > Oh that's an interesting point. But that sounds to me like the problem > with this patch is not that it makes /dev/urandom block (its primary > purpose) but that it also removes GRND_INSECURE (a distraction). So > perhaps an improved patch would be something like the below, which > changes /dev/urandom for new kernels but doesn't remove GRND_INSECURE. > Then your hash tables could continue to use GRND_INSECURE and all would > be well. (And for kernels without getrandom(), they'd just fall back to > /dev/urandom like normal which would have old semantics, so works.) In fact, systemd already uses getrandom(GRND_INSECURE) for this, if it is supported, and falls back to /dev/urandom only if it is not. So as long as GRND_INSECURE remains available we are good. Lennart -- Lennart Poettering, Berlin