[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yf58b+olLdLN2j/z@owl.dominikbrodowski.net>
Date: Sat, 5 Feb 2022 14:32:31 +0100
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
Theodore Ts'o <tytso@....edu>
Subject: Re: [PATCH 1/2] random: fix locking in crng_fast_load()
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
Powered by blists - more mailing lists