From: Dominik Brodowski <linux@dominikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH 1/2] random: fix locking in crng_fast_load()
Date: Sat, 5 Feb 2022 14:32:31 +0100 [thread overview]
Message-ID: <Yf58b+olLdLN2j/z@owl.dominikbrodowski.net> (raw)
In-Reply-To: <CAHmME9rsDkn=qRacYbZFjni5FF6G2dn+KOELr-agPhmH7ved0g@mail.gmail.com>
Hi Jason,
Am Sat, Feb 05, 2022 at 02:17:15PM +0100 schrieb Jason A. Donenfeld:
> Does this introduce a lock nesting inversion situation?
>
> With your patch, crng_fast_load() now does:
>
> lock(primary_crng)
> invalidate_batched_entropy()
> lock(batch_lock)
> unlock(batch_lock)
> unlock(primary_crng)
>
> While get_random_{u32,u64}() does:
>
> lock(batch_lock)
> extract_crng()
> lock(primary_crng)
> unlock(primary_crng)
> unlock(batch_lock)
>
> Is this correct? If so, we might have to defer this patch until after
> <https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/commit/?id=2dfab1b1>
> or something like it lands, which attempts to get rid of the batched
> entropy lock.
>
> If that analysis seems right to you, I could pull this patch into that
> development branch for poking and prodding.
Right, this makes sense -- I already "read" invalidate_batched_entropy() as
being just a call to atomic_inc().
Thanks,
Dominik
next prev parent reply other threads:[~2022-02-05 13:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-05 10:34 [PATCH 0/2] random: fix write locking for crng_init Dominik Brodowski
2022-02-05 10:34 ` [PATCH 1/2] random: fix locking in crng_fast_load() Dominik Brodowski
2022-02-05 13:17 ` Jason A. Donenfeld
2022-02-05 13:32 ` Dominik Brodowski [this message]
2022-02-21 2:32 ` Eric Biggers
2022-02-05 10:34 ` [PATCH 2/2] random: fix locking for crng_init in crng_reseed() Dominik Brodowski
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=Yf58b+olLdLN2j/z@owl.dominikbrodowski.net \
--to=linux@dominikbrodowski.net \
--cc=Jason@zx2c4.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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®