From: Ard Biesheuvel <ardb@kernel.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH v2] crypto: reduce minimum alignment of on-stack structures
Date: Fri, 8 Jan 2021 23:49:32 +0100 [thread overview]
Message-ID: <CAMj1kXE8SPE+2HazN6whvYr5anZWJJ8n4UAVyotPV1XySkk0Rg@mail.gmail.com> (raw)
In-Reply-To: <X/jLtI1m96DD+QLO@sol.localdomain>
On Fri, 8 Jan 2021 at 22:16, Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Fri, Jan 08, 2021 at 06:17:06PM +0100, Ard Biesheuvel wrote:
> > diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
> > index 6a733b171a5d..aa133dc3bf39 100644
> > --- a/include/crypto/skcipher.h
> > +++ b/include/crypto/skcipher.h
> > @@ -128,7 +128,7 @@ struct skcipher_alg {
> > MAX_SYNC_SKCIPHER_REQSIZE + \
> > (!(sizeof((struct crypto_sync_skcipher *)1 == \
> > (typeof(tfm))1))) \
> > - ] CRYPTO_MINALIGN_ATTR; \
> > + ] __aligned(ARCH_SLAB_MINALIGN); \
> > struct skcipher_request *name = (void *)__##name##_desc
> >
>
> Are you sure this is okay? __alignof__(struct skcipher_request) will still be
> CRYPTO_MINALIGN_ATTR, since it contains a field with that alignment. So
> technically isn't the full alignment still needed, as the compiler can assume
> that struct skcipher_request is CRYPTO_MINALIGN_ATTR-aligned?
>
The assumption is that ARCH_SLAB_MINALIGN should be sufficient for any
POD type, But I guess that in order to be fully correct, the actual
alignment of the struct type should be ARCH_SLAB_MINALIGN, and __ctx
should just be padded out so it appears at an offset that is a
multiple of ARCH_KMALLOC_ALIGN.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-01-08 22:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 17:17 [PATCH v2] crypto: reduce minimum alignment of on-stack structures Ard Biesheuvel
2021-01-08 21:16 ` Eric Biggers
2021-01-08 22:49 ` Ard Biesheuvel [this message]
2021-01-13 6:26 ` Herbert Xu
2021-01-13 8:18 ` Ard Biesheuvel
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=CAMj1kXE8SPE+2HazN6whvYr5anZWJJ8n4UAVyotPV1XySkk0Rg@mail.gmail.com \
--to=ardb@kernel.org \
--cc=arnd@arndb.de \
--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).