Re: [PATCH RFC v2] random: optionally block in getrandom(2) when the CRNG is uninitialized
From: Linus Torvalds
Date: Sun Sep 15 2019 - 15:08:57 EST
On Sun, Sep 15, 2019 at 11:37 AM Willy Tarreau <w@xxxxxx> wrote:
>
> I also wanted to ask, are we going to enforce the same strategy on
> /dev/urandom ?
Right now the strategy for /dev/urandom is "print a one-line warning,
then do the read".
I don't see why we should change that. The whole point of urandom has
been that it doesn't block, and doesn't use up entropy.
It's the _blocking_ behavior that has always been problematic. It's
why almost nobody uses /dev/random in practice.
getrandom() looks like /dev/urandom in not using up entropy, but had
that blocking behavior of /dev/random that was problematic.
And exactly the same way it was problematic for /dev/random users, it
has now shown itself to be problematic for getrandom().
My suggested patch left the /dev/random blocking behavior, because
hopefully people *know* about the problems there.
And hopefully people understand that getrandom(GRND_RANDOM) has all
the same issues.
If you want that behavior, you can still use GRND_RANDOM or
/dev/random, but they are simply not acceptable for boot-time
schenarios. Never have been,
... exactly the way the "block forever" wasn't acceptable for getrandom().
Linus