Re: [PATCH] random: tie batched entropy generation to base_crng generation

From: Jason A. Donenfeld
Date: Thu Feb 10 2022 - 08:10:09 EST


Hi Dominik,

On Thu, Feb 10, 2022 at 7:04 AM Dominik Brodowski
<linux@xxxxxxxxxxxxxxxxxxxx> wrote:
> Here we do not need to take a lock (single-threaded operation), can only be
> at generation 0 or 1, and the base_crng.key has changed. Which leads me to
> ask: shouldn't we increase the generation counter always (or at least if
> arch_init is true)? And just make icnrementing crng_init to 2 depending on
> trust_cpu?

Interesting consideration. I think incrementing the generation counter
there unconditionally can't hurt. It should be done every time the
base_crng key changes, which there it clearly does since we're
extracting into it. I'll go ahead and do that.

Jason