From: Harald Freudenberger <freude@linux.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Eric Biggers <ebiggers@kernel.org>,
davem@davemloft.net, dengler@linux.ibm.com,
linux-s390@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v5 3/3] s390/crypto: New s390 specific protected key hash phmac
Date: Mon, 25 Nov 2024 14:00:52 +0100 [thread overview]
Message-ID: <079dc622ca9f4b6883c62025adb336b9@linux.ibm.com> (raw)
In-Reply-To: <Z0QUl_eSUwEANb4s@gondor.apana.org.au>
On 2024-11-25 07:09, Herbert Xu wrote:
> On Fri, Nov 22, 2024 at 03:34:27PM +0100, Harald Freudenberger wrote:
>>
>> +static inline int phmac_keyblob2pkey(const u8 *key, unsigned int
>> keylen,
>> + struct phmac_protkey *pk)
>> +{
>> + int i, rc = -EIO;
>> +
>> + /* try three times in case of busy card */
>> + for (i = 0; rc && i < 3; i++) {
>> + if (rc == -EBUSY && msleep_interruptible(1000))
>> + return -EINTR;
>
> You can't sleep in crypto calls in general.
>
> Now there are specific circumstances where sleeping is allowed,
> e.g., when the MAY_SLEEP flag is set, but I don't think this will
> be acceptable for your purpose.
>
> I see the same problem exists in paes_s390, which was not reviewed
> on linux-crypto.
>
> So what exactly causes the EBUSY? The 3 retries followed by failure
> seem rather dangerous too given that this could be used by the block
> layer for critical data that cannot fail.
>
> Cheers,
Well, I fear the paes implementation is similar broken. The EBUSY
is a reaction of the zcrpyt/AP bus when no eligible crypto card has
been found and a ansynchronous bus scan is running. In that case the
caller should retry in the hope that the bus scan detects a eligible
card.
Please note that the sleep only happens in in_task() context for the
paes implementation.
For the phmac implementation - didn't you suggest to wrap this with
an asynchronous hmac to be able to sleep in the wrapped synchronous
hmac?
next prev parent reply other threads:[~2024-11-25 13:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 14:34 [PATCH v5 0/3] New s390 specific protected key hmac Harald Freudenberger
2024-11-22 14:34 ` [PATCH v5 1/3] crypto: api - Adjust HASH_MAX_DESCSIZE for s390-phmac context Harald Freudenberger
2024-11-22 14:34 ` [PATCH v5 2/3] s390/crypto: Add protected key hmac subfunctions for KMAC Harald Freudenberger
2024-11-22 14:34 ` [PATCH v5 3/3] s390/crypto: New s390 specific protected key hash phmac Harald Freudenberger
2024-11-25 6:09 ` Herbert Xu
2024-11-25 13:00 ` Harald Freudenberger [this message]
2024-11-26 11:53 ` Herbert Xu
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=079dc622ca9f4b6883c62025adb336b9@linux.ibm.com \
--to=freude@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=dengler@linux.ibm.com \
--cc=ebiggers@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/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