From: Herbert Xu <herbert@gondor.apana.org.au>
To: Haixin Xu <jerryxucs@gmail.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, smueller@chronox.de, yifanwucs@gmail.com,
tomapufckgml@gmail.com, yuantan098@gmail.com, bird@lzu.edu.cn
Subject: Re: [PATCH 1/1] crypto: jitterentropy - replace long-held spinlock with mutex
Date: Sun, 12 Apr 2026 16:50:59 +0800 [thread overview]
Message-ID: <adtc86185G19rHgJ@gondor.apana.org.au> (raw)
In-Reply-To: <9a8ef1cbcc68b752a495acf0a23e7095eb0a7796.1774854094.git.jerryxucs@gmail.com>
On Mon, Mar 30, 2026 at 03:23:46PM +0800, Haixin Xu wrote:
> jent_kcapi_random() serializes the shared jitterentropy state, but it
> currently holds a spinlock across the jent_read_entropy() call. That
> path performs expensive jitter collection and SHA3 conditioning, so
> parallel readers can trigger stalls as contending waiters spin for
> the same lock.
>
> To prevent non-preemptible lock hold, replace rng->jent_lock with a
> mutex so contended readers sleep instead of spinning on a shared lock
> held across expensive entropy generation.
>
> Fixes: bb5530e40824 ("crypto: jitterentropy - add jitterentropy RNG")
> Reported-by: Yifan Wu <yifanwucs@gmail.com>
> Reported-by: Juefei Pu <tomapufckgml@gmail.com>
> Reported-by: Yuan Tan <yuantan098@gmail.com>
> Suggested-by: Xin Liu <bird@lzu.edu.cn>
> Signed-off-by: Haixin Xu <jerryxucs@gmail.com>
> ---
> crypto/jitterentropy-kcapi.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2026-04-12 8:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 7:23 [PATCH 0/1] crypto: jitterentropy - fix long-held spinlock contention Haixin Xu
2026-03-30 7:23 ` [PATCH 1/1] crypto: jitterentropy - replace long-held spinlock with mutex Haixin Xu
2026-03-30 7:36 ` Stephan Mueller
2026-03-30 8:51 ` Herbert Xu
2026-03-30 13:50 ` Haixin Xu
2026-04-12 8:50 ` Herbert Xu [this message]
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=adtc86185G19rHgJ@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=bird@lzu.edu.cn \
--cc=davem@davemloft.net \
--cc=jerryxucs@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smueller@chronox.de \
--cc=tomapufckgml@gmail.com \
--cc=yifanwucs@gmail.com \
--cc=yuantan098@gmail.com \
/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