From: Eric Biggers <ebiggers@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Dominik Brodowski <linux@dominikbrodowski.net>
Subject: Re: [PATCH v2] random: tie batched entropy generation to base_crng generation
Date: Sun, 20 Feb 2022 20:13:51 -0800 [thread overview]
Message-ID: <YhMRf1tqgB/zSvAs@sol.localdomain> (raw)
In-Reply-To: <20220210131304.97224-1-Jason@zx2c4.com>
On Thu, Feb 10, 2022 at 02:13:04PM +0100, Jason A. Donenfeld wrote:
> Now that we have an explicit base_crng generation counter, we don't need
> a separate one for batched entropy. Rather, we can just move the
> generation forward every time we change crng_init state or update the
> base_crng key.
>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> v2 always increments the generation after extraction, as suggested by
> Dominik.
>
> drivers/char/random.c | 29 ++++++++---------------------
> 1 file changed, 8 insertions(+), 21 deletions(-)
Reviewed-by: Eric Biggers <ebiggers@google.com>
One comment below:
> @@ -455,7 +453,7 @@ static size_t crng_fast_load(const void *cp, size_t len)
> src++; crng_init_cnt++; len--; ret++;
> }
> if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) {
> - invalidate_batched_entropy();
> + ++base_crng.generation;
> crng_init = 1;
> }
This is an existing issue, but why doesn't crng_slow_load() do this too?
- Eric
next prev parent reply other threads:[~2022-02-21 4:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 18:57 [PATCH] random: fix locking for crng_init in crng_reseed() Dominik Brodowski
2022-02-09 21:39 ` Jason A. Donenfeld
2022-02-09 21:54 ` [PATCH] random: tie batched entropy generation to base_crng generation Jason A. Donenfeld
2022-02-10 6:00 ` Dominik Brodowski
2022-02-10 13:09 ` Jason A. Donenfeld
2022-02-10 13:13 ` [PATCH v2] " Jason A. Donenfeld
2022-02-21 4:13 ` Eric Biggers [this message]
2022-02-21 14:35 ` Jason A. Donenfeld
2022-02-10 5:43 ` [PATCH] random: fix locking for crng_init in crng_reseed() Dominik Brodowski
2022-02-10 13:07 ` Jason A. Donenfeld
2022-02-21 4:05 ` Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YhMRf1tqgB/zSvAs@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®