All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Howells <dhowells@redhat.com>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org
Subject: Re: Bug report: unaligned access with ext4 encryption
Date: Thu, 10 Jan 2019 23:01:14 +0000	[thread overview]
Message-ID: <20190110230114.GF149637@gmail.com> (raw)
In-Reply-To: <20190110222928.GB22416@darkstar.musicnaut.iki.fi>

On Fri, Jan 11, 2019 at 12:29:28AM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Fri, Jan 04, 2019 at 05:28:02PM +0000, David Howells wrote:
> > Eric Biggers <ebiggers@kernel.org> wrote:
> > > Hi Aaro, thanks for the bug report!  I think you're on the right track; it makes
> > > much more sense to have the keyrings subsystem store the payload with better
> > > alignment, than to work around the 2-byte alignment in fscrypt.
> > > 
> > > But how about '__aligned(__alignof__(u64))' instead?  4 bytes may not be enough.
> > > 
> > > David, what do you think?
> > 
> > Does that even work?
> 
> That should work.
> 
> > Might be better to just insert 6 bytes of padding with a comment, but yes I
> > agree that it's probably better to align it to at least machine word size.
> 
> Padding is fragile, e.g. if struct rcu_head changes. Using __aligned should
> make it always right automatically.
> 
> A.

I agree that __aligned is better.  It should work; see 'struct crypto_tfm' in
include/linux/crypto.h for another example of a struct that uses __aligned on a
flexible array at the end.

Aaro, can you send a formal patch?  If you don't I'll do so, but I figure I'll
ask first.

Thanks,

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Howells <dhowells@redhat.com>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org
Subject: Re: Bug report: unaligned access with ext4 encryption
Date: Thu, 10 Jan 2019 15:01:14 -0800	[thread overview]
Message-ID: <20190110230114.GF149637@gmail.com> (raw)
In-Reply-To: <20190110222928.GB22416@darkstar.musicnaut.iki.fi>

On Fri, Jan 11, 2019 at 12:29:28AM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Fri, Jan 04, 2019 at 05:28:02PM +0000, David Howells wrote:
> > Eric Biggers <ebiggers@kernel.org> wrote:
> > > Hi Aaro, thanks for the bug report!  I think you're on the right track; it makes
> > > much more sense to have the keyrings subsystem store the payload with better
> > > alignment, than to work around the 2-byte alignment in fscrypt.
> > > 
> > > But how about '__aligned(__alignof__(u64))' instead?  4 bytes may not be enough.
> > > 
> > > David, what do you think?
> > 
> > Does that even work?
> 
> That should work.
> 
> > Might be better to just insert 6 bytes of padding with a comment, but yes I
> > agree that it's probably better to align it to at least machine word size.
> 
> Padding is fragile, e.g. if struct rcu_head changes. Using __aligned should
> make it always right automatically.
> 
> A.

I agree that __aligned is better.  It should work; see 'struct crypto_tfm' in
include/linux/crypto.h for another example of a struct that uses __aligned on a
flexible array at the end.

Aaro, can you send a formal patch?  If you don't I'll do so, but I figure I'll
ask first.

Thanks,

- Eric

  reply	other threads:[~2019-01-10 23:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-30 16:29 Bug report: unaligned access with ext4 encryption Aaro Koskinen
2018-12-30 16:29 ` Aaro Koskinen
2019-01-03 17:17 ` Eric Biggers
2019-01-03 17:17   ` Eric Biggers
2019-01-04 17:28   ` David Howells
2019-01-10 22:29     ` Aaro Koskinen
2019-01-10 22:29       ` Aaro Koskinen
2019-01-10 23:01       ` Eric Biggers [this message]
2019-01-10 23:01         ` Eric Biggers
2019-01-10 23:35         ` Aaro Koskinen
2019-01-10 23:35           ` Aaro Koskinen

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=20190110230114.GF149637@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=aaro.koskinen@iki.fi \
    --cc=dhowells@redhat.com \
    --cc=jaegeuk@kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.