[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgN5wp58XHYd7/WA@owl.dominikbrodowski.net>
Date: Wed, 9 Feb 2022 09:22:26 +0100
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
tytso@....edu, ebiggers@...nel.org
Subject: Re: [PATCH v2 2/9] random: get rid of secondary crngs
Just one question (which was already present in the past, but...):
> - WRITE_ONCE(crng->init_time, jiffies);
> - spin_unlock_irqrestore(&crng->lock, flags);
> - if (crng == &primary_crng && crng_init < 2)
> - crng_finalize_init();
> + WRITE_ONCE(primary_crng.init_time, jiffies);
> + spin_unlock_irqrestore(&primary_crng.lock, flags);
> + if (crng_init < 2) {
> + invalidate_batched_entropy();
> + crng_init = 2;
Might this branch be taken twice if crng_reseed() is called concurrently
twice? If so, we'd need to increment crng_init while holding the lock,
such as I suggested in my patch "random: fix locking for crng_init in
crng_reseed()". But that can be deferred to an additional patch.
Thanks,
Dominik
Powered by blists - more mailing lists