linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Eric Biggers <ebiggers@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH] crypto - shash: reduce minimum alignment of shash_desc structure
Date: Fri, 8 Jan 2021 12:31:59 +0100	[thread overview]
Message-ID: <CAMj1kXEeOwj5G_nFU6H_u8V7J9dD+yD7LGaH9FidYtfi-syT1A@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a0W0jcqrt1Vp_+qf11y6P5Wy9--f+ou1gEwivizpTShaA@mail.gmail.com>

On Fri, 8 Jan 2021 at 11:59, Arnd Bergmann <arnd@kernel.org> wrote:
>
> On Fri, Jan 8, 2021 at 11:44 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
> >
> > On Fri, Jan 08, 2021 at 11:42:53AM +0100, Arnd Bergmann wrote:
> > >
> > > How does this work for kernels with CONFIG_VMAP_STACK?
> > > I remember some other subsystems (usb, hid) adding workarounds
> > > for that, but I don't see those in drivers/crypto
> >
> > I'm referring to the situation in general and not the subject of
> > this thread.
> >
> > For shash_desc of course it doesn't happen since it sync only.
>
> Ah, got it.
>

I can fold in the following

--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -151,9 +151,12 @@
  * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
  * declaration) is used to ensure that the crypto_tfm context structure is
  * aligned correctly for the given architecture so that there are no alignment
- * faults for C data types.  In particular, this is required on platforms such
- * as arm where pointers are 32-bit aligned but there are data types such as
- * u64 which require 64-bit alignment.
+ * faults for C data types.  On architectures that support non-cache coherent
+ * DMA, such as ARM or arm64, it also takes into account the minimal alignment
+ * that is required to ensure that the context struct member does not share any
+ * cachelines with the rest of the struct. This is needed to ensure that cache
+ * maintenance for non-coherent DMA does not affect data that may be accessed
+ * by the CPU concurrently.
  */
 #define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN


(or send it as a separate patch)

Note that the comment about 64-bit alignment for 64-bit types on ARM
is incorrect.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2021-01-08 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 12:41 [PATCH] crypto - shash: reduce minimum alignment of shash_desc structure Ard Biesheuvel
2021-01-07 19:02 ` Eric Biggers
2021-01-08  8:36   ` Ard Biesheuvel
2021-01-08  9:22     ` Herbert Xu
2021-01-08  9:32       ` Ard Biesheuvel
2021-01-08 10:42       ` Arnd Bergmann
2021-01-08 10:44         ` Herbert Xu
2021-01-08 10:59           ` Arnd Bergmann
2021-01-08 11:31             ` Ard Biesheuvel [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=CAMj1kXEeOwj5G_nFU6H_u8V7J9dD+yD7LGaH9FidYtfi-syT1A@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@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;
as well as URLs for NNTP newsgroup(s).