Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Changwei Zou <changwei.zou@canonical.com>
Cc: horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com,
	davem@davemloft.net, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, lukas@wunner.de
Subject: Re: [PATCH] crypto: caam - Use bounce buffer for unaligned RSA destination buffers
Date: Sat, 15 Aug 2026 11:00:33 +1000	[thread overview]
Message-ID: <an-6Mew-8fQaf5sb@gondor.apana.org.au> (raw)
In-Reply-To: <20260805041902.1575170-1-changwei.zou@canonical.com>

On Wed, Aug 05, 2026 at 02:19:02PM +1000, Changwei Zou wrote:
> The CAAM RSA driver directly DMA-maps the destination buffer supplied by
> the caller via req->dst without checking whether it meets the cacheline
> alignment requirements of DMA-incoherent hardware such as i.MX8.
> 
> On CPUs with non-coherent DMA caches, if the destination buffer shares a
> cacheline with other data (i.e. it is not cacheline-aligned), cache
> writeback/invalidation during DMA can corrupt adjacent memory or cause
> stale data to be read back. This manifests as intermittent -EKEYREJECTED
> errors when loading signed kernel modules.
> 
> When any segment of req->dst is not cacheline-aligned, allocate a
> single contiguous aligned bounce buffer covering the full dst_len,
> redirect the operation to it, and scatter-copy the result back to the
> original destination once the hardware has completed the operation.
> 
> The intermittent error 'Key was rejected by service' on i.MX8 with CAAM
> can be triggered when loading signed kernel modules:
> 
>     for i in $(seq 1 100); do
>         sudo modprobe xfs 2>&1 && echo "SUCCESS on attempt $i" \
>         && sudo rmmod xfs || echo "FAILED on attempt $i"
>     done
> 
> Signed-off-by: Changwei Zou <changwei.zou@canonical.com>
> Assisted-by: OpenCode:claude-sonnet-4.6
> ---
>  drivers/crypto/caam/caampkc.c | 66 ++++++++++++++++++++++++++++++++++-
>  drivers/crypto/caam/caampkc.h |  6 ++++
>  2 files changed, 71 insertions(+), 1 deletion(-)

Please take a look at the Sashiko reviews:

https://sashiko.dev/#/patchset/20260805041902.1575170-1-changwei.zou%40canonical.com

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

  reply	other threads:[~2026-08-15  1:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  4:19 [PATCH] crypto: caam - Use bounce buffer for unaligned RSA destination buffers Changwei Zou
2026-08-15  1:00 ` Herbert Xu [this message]
2026-08-21  5:18   ` Changwei Zou
2026-09-04  5:37     ` [PATCH] crypto: caam - Remove public key support Herbert Xu
2026-09-09  7:23       ` [EXT] " Varun Sethi

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=an-6Mew-8fQaf5sb@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=changwei.zou@canonical.com \
    --cc=davem@davemloft.net \
    --cc=gaurav.jain@nxp.com \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=pankaj.gupta@nxp.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