linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC PATCH v2 7/8] fscrypt: wire up fscrypt to use blk-crypto
       [not found]   ` <20190613185556.GD686@sol.localdomain>
@ 2019-06-13 21:30     ` Andreas Dilger
  2019-06-13 21:48       ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Dilger @ 2019-06-13 21:30 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-ext4, Sebastien Buisson

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

[reduced CC list, since I don't think this is interesting outside ext4]

On Jun 13, 2019, at 12:55 PM, Eric Biggers <ebiggers@kernel.org> wrote:
> 
> What it really enables is a cryptosystem and on-disk format change where, for
> the purpose of working better with inline encryption, file contents are
> encrypted with the master key directly (or for v2 encryption policies it will be
> a per-mode derived key as it really should be, once we can actually get the v2
> encryption policy support reviewed and merged), and the inode numbers are added
> to the IVs.  As we know, when ext4 support is added, this will also preclude the
> filesystem from being resized.

Just as an aside, I thought that the inode number would *not* be added to the IV,
exactly so that ext4 filesystem resize would work?

I guess it shouldn't *strictly* preventing filesystem resizing, only the case of
shrinking the filesystem and having to relocate encrypted inodes.  Expanding the
filesystem shouldn't have that problem at all, nor should shrinking if there isn't
a need to relocate the encrypted inodes.  Moving encrypted blocks should be OK,
since the logical block numbers (and hence derived block IV) would stay the same.

Something like https://patchwork.ozlabs.org/patch/960766/ "Add block_high_watermark
sysfs tunable" would allow pre-migrating encrypted files in userspace via data copy
(read/decrypt+write/encrypt) before doing the resize, if necessary, so that files
do not use inode numbers that will be cut off the end of the filesystem.

Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH v2 7/8] fscrypt: wire up fscrypt to use blk-crypto
  2019-06-13 21:30     ` [RFC PATCH v2 7/8] fscrypt: wire up fscrypt to use blk-crypto Andreas Dilger
@ 2019-06-13 21:48       ` Eric Biggers
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2019-06-13 21:48 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: linux-ext4, Sebastien Buisson, Satya Tangirala, Paul Crowley

[+Satya and Paul]

On Thu, Jun 13, 2019 at 03:30:13PM -0600, Andreas Dilger wrote:
> [reduced CC list, since I don't think this is interesting outside ext4]
> 
> On Jun 13, 2019, at 12:55 PM, Eric Biggers <ebiggers@kernel.org> wrote:
> > 
> > What it really enables is a cryptosystem and on-disk format change where, for
> > the purpose of working better with inline encryption, file contents are
> > encrypted with the master key directly (or for v2 encryption policies it will be
> > a per-mode derived key as it really should be, once we can actually get the v2
> > encryption policy support reviewed and merged), and the inode numbers are added
> > to the IVs.  As we know, when ext4 support is added, this will also preclude the
> > filesystem from being resized.
> 
> Just as an aside, I thought that the inode number would *not* be added to the IV,
> exactly so that ext4 filesystem resize would work?
> 
> I guess it shouldn't *strictly* preventing filesystem resizing, only the case of
> shrinking the filesystem and having to relocate encrypted inodes.  Expanding the
> filesystem shouldn't have that problem at all, nor should shrinking if there isn't
> a need to relocate the encrypted inodes.  Moving encrypted blocks should be OK,
> since the logical block numbers (and hence derived block IV) would stay the same.
> 

Yes, this is all correct.  The limitation on ext4 filesystem shrinking will be a
tradeoff to get inline encryption support to work efficiently.  Satya hasn't
implemented ext4 support yet, but as part of it I think we'll need to add an
ext4 superblock feature flag that forbids filesystem shrinking.

So unless we find a better way, people who need ext4 filesystem shrinking will
need to use the existing ext4 encryption format instead, which isn't optimized
for inline encryption.

This isn't an issue for Android (the motivating use case for this) since the
user data partition on Android devices is never shrunk.

> Something like https://patchwork.ozlabs.org/patch/960766/ "Add block_high_watermark
> sysfs tunable" would allow pre-migrating encrypted files in userspace via data copy
> (read/decrypt+write/encrypt) before doing the resize, if necessary, so that files
> do not use inode numbers that will be cut off the end of the filesystem.

If I understand that patch correctly, it only implements a high watermark for
data blocks, not inode numbers?  We need to ensure that an inode number is never
changed without also decrypting + encrypting the data.

- Eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-13 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190605232837.31545-1-satyat@google.com>
     [not found] ` <20190605232837.31545-8-satyat@google.com>
     [not found]   ` <20190613185556.GD686@sol.localdomain>
2019-06-13 21:30     ` [RFC PATCH v2 7/8] fscrypt: wire up fscrypt to use blk-crypto Andreas Dilger
2019-06-13 21:48       ` Eric Biggers

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).