[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wib4v7epabkEZmk5ZsJhHBX5UiVCwT9BWyeWrOwMrKkrA@mail.gmail.com>
Date: Tue, 5 Apr 2022 11:56:33 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
"Theodore Ts'o" <tytso@....edu>,
Dominik Brodowski <linux@...inikbrodowski.net>
Subject: Re: [PATCH] random: opportunistically initialize on /dev/urandom reads
On Tue, Apr 5, 2022 at 11:31 AM Jason A. Donenfeld <Jason@...c4.com> wrote:
>
> It sounds like your suggestion would be to make that:
>
> while (!crng_ready()) {
> int ret;
>
> try_to_generate_entropy();
> if (nodelay && !crng_ready()) {
> warn(...);
> return -EBUSY;
> }
> ret = wait_event_interruptible_timeout(crng_init_wait, crng_ready(), HZ);
> if (ret)
> return ret > 0 ? 0 : ret;
> }
Yes. Except I'd almost warn for the "ret < 0" case too, since almost
nobody seems to check it.
But hey, maybe callers that are interrupted by a signal check for that
separately. I guess it's _possible_.
Linus
Powered by blists - more mailing lists