[+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@xxxxxxxxxx> 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