On Sun, Sep 29, 2019 at 11:10 PM Borislav Petkov <b...@alien8.de> wrote: > > so sshd does getrandom(2) while those other userspace things don't. Oh > well.
Well, that's actually what systems _should_ do. Presumably sshd actually wants secure randomness, and nothing else waits for it. Obviously, that can be a problem if you then need sshd in order to get into a headless box, so my patch fixes things for you too, but at least your box doesn't show the problem that Ahmed had, and the boot completing presumably means that you got more entropy from other disk IO being done by the rest of the boot. If you want to test my hacky "do /dev/urandom too", it was this one-liner: --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2027,6 +2027,7 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) static int maxwarn = 10; int ret; + if (!crng_ready()) try_to_generate_entropy(); if (!crng_ready() && maxwarn > 0) { maxwarn--; if (__ratelimit(&urandom_warning)) and that should get rid of the warnings. It's not using the full "wait_for_random_bytes()", because in the absence of a cycle counter, that would introduce the boot-time lockup for /dev/urandom too. Doing something like the above to /dev/urandom is likely the right thing to do eventually, but I didn't want to mix up "we can perhaps improve the urandom situation too" with the basic "let's fix the boot problem". The urandom behavior change would be a separate thing. Also, talking about "future changes". Right now "try_to_generate_entropy()" is actually uninterruptible once it gets started. I think we should add a test for signal_pending() too, but it should generally complete really fairly quickly so I left it without one just to see if anybody even notices. Linus