Re: Linux 5.3-rc8
From: Willy Tarreau
Date: Tue Sep 17 2019 - 01:25:20 EST
On Mon, Sep 16, 2019 at 06:46:07PM -0700, Matthew Garrett wrote:
> >Well, the patch actually made getrandom() return en error too, but you
> >seem more interested in the hypotheticals than in arguing actualities.
>
> If you want to be safe, terminate the process.
This is an interesting approach. At least it will cause bug reports in
application using getrandom() in an unreliable way and they will check
for other options. Because one of the issues with systems that do not
finish to boot is that usually the user doesn't know what process is
hanging.
Anyway regarding the impact on applications relying on getrandom() for
security, I'm in favor of not *silently* changing their behavior and
provide a new flag to help others get insecure randoms without waiting.
With your option above we could then have this way to go:
- GRND_SECURE: the application wants secure randoms, i.e. like
the current getrandom(0), waiting for entropy.
- GRND_INSECURE: the application never wants to wait, it just
wants a replacement for /dev/urandom.
- GRND_RANDOM: unchanged, or subject to CAP_xxx, or maybe just emit
a "deprecated" warning if called without a certain capability, to
spot potentially harmful applications.
- by default (0), the application continues to wait but when the
timeout strikes (30 seconds ?), it gets terminated with a
message in the logs for users to report the issue.
After some time all relevant applications which accidently misuse
getrandom() will be fixed to either use GRND_INSECURE or GRND_SECURE
and be able to wait longer if they want (likely SECURE|NONBLOCK).
Willy