android_kernel_motorola_sm6375/fs/crypto
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Eric Biggers 8de6a8d30b ANDROID: fscrypt: handle direct I/O with IV_INO_LBLK_32
With the existing fscrypt IV generation methods, each file's data blocks
have contiguous DUNs.  Therefore the direct I/O code "just worked"
because it only submits logically contiguous bios.  But with
IV_INO_LBLK_32, the direct I/O code breaks because the DUN can wrap from
0xffffffff to 0.  We can't submit bios across such boundaries.

This is especially difficult to handle when block_size != PAGE_SIZE,
since in that case the DUN can wrap in the middle of a page.  Punt on
this case for now and just handle block_size == PAGE_SIZE.

Add and use a new function fscrypt_dio_supported() to check whether a
direct I/O request is unsupported due to encryption constraints.

Then, update fs/direct-io.c (used by f2fs, and by ext4 in kernel v5.4
and earlier) and fs/iomap/direct-io.c (used by ext4 in kernel v5.5 and
later) to avoid submitting I/O across a DUN discontinuity.

(This is needed in ACK now because ACK already supports direct I/O with
inline crypto.  I'll be sending this upstream along with the encrypted
direct I/O support itself once its prerequisites are closer to landing.)

(cherry picked from android-mainline commit
 8d6c90c9d68b985fa809626d12f8c9aff3c9dcb1)

Conflicts:
	fs/ext4/file.c
	fs/iomap/direct-io.c

(Dropped the iomap changes because in kernel v5.4 and earlier,
 ext4 doesn't use iomap for direct I/O)

Test: For now, just manually tested direct I/O on ext4 and f2fs in the
      DUN discontinuity case.
Bug: 144046242
Change-Id: I0c0b0b20a73ade35c3660cc6f9c09d49d3853ba5
Signed-off-by: Eric Biggers <ebiggers@google.com>
2020-05-21 11:52:18 -07:00
..
bio.c Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.4.y' into android-5.4 2020-02-20 12:31:26 -08:00
crypto.c ANDROID: fscrypt: handle direct I/O with IV_INO_LBLK_32 2020-05-21 11:52:18 -07:00
fname.c ANDROID: fscrypt: fix export symbol type 2020-04-29 19:12:47 +02:00
fscrypt_private.h BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_32 policies 2020-05-21 11:40:32 -07:00
hkdf.c fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand() 2020-02-12 19:35:18 -08:00
hooks.c FROMLIST: fscrypt: Have filesystems handle their d_ops 2020-02-20 21:21:40 +00:00
inline_crypt.c ANDROID: fscrypt: handle direct I/O with IV_INO_LBLK_32 2020-05-21 11:52:18 -07:00
Kconfig Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.4.y' into android-5.4 2020-02-20 12:31:26 -08:00
keyring.c BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_32 policies 2020-05-21 11:40:32 -07:00
keysetup.c BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_32 policies 2020-05-21 11:40:32 -07:00
keysetup_v1.c ANDROID: block: Prevent crypto fallback for wrapped keys 2020-02-25 19:27:51 +00:00
Makefile FROMLIST: fscrypt: add inline encryption support 2019-10-30 22:01:39 +00:00
policy.c BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_32 policies 2020-05-21 11:40:32 -07:00