[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9rsDkn=qRacYbZFjni5FF6G2dn+KOELr-agPhmH7ved0g@mail.gmail.com>
Date: Sat, 5 Feb 2022 14:17:15 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Dominik Brodowski <linux@...inikbrodowski.net>
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 Dominik,
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.
Jason
Powered by blists - more mailing lists