linux-stable/Documentation/filesystems
Eric Biggers b103fb7653 fscrypt: add support for IV_INO_LBLK_64 policies
Inline encryption hardware compliant with the UFS v2.1 standard or with
the upcoming version of the eMMC standard has the following properties:

(1) Per I/O request, the encryption key is specified by a previously
    loaded keyslot.  There might be only a small number of keyslots.

(2) Per I/O request, the starting IV is specified by a 64-bit "data unit
    number" (DUN).  IV bits 64-127 are assumed to be 0.  The hardware
    automatically increments the DUN for each "data unit" of
    configurable size in the request, e.g. for each filesystem block.

Property (1) makes it inefficient to use the traditional fscrypt
per-file keys.  Property (2) precludes the use of the existing
DIRECT_KEY fscrypt policy flag, which needs at least 192 IV bits.

Therefore, add a new fscrypt policy flag IV_INO_LBLK_64 which causes the
encryption to modified as follows:

- The encryption keys are derived from the master key, encryption mode
  number, and filesystem UUID.

- The IVs are chosen as (inode_number << 32) | file_logical_block_num.
  For filenames encryption, file_logical_block_num is 0.

Since the file nonces aren't used in the key derivation, many files may
share the same encryption key.  This is much more efficient on the
target hardware.  Including the inode number in the IVs and mixing the
filesystem UUID into the keys ensures that data in different files is
nevertheless still encrypted differently.

Additionally, limiting the inode and block numbers to 32 bits and
placing the block number in the low bits maintains compatibility with
the 64-bit DUN convention (property (2) above).

Since this scheme assumes that inode numbers are stable (which may
preclude filesystem shrinking) and that inode and file logical block
numbers are at most 32-bit, IV_INO_LBLK_64 will only be allowed on
filesystems that meet these constraints.  These are acceptable
limitations for the cases where this format would actually be used.

Note that IV_INO_LBLK_64 is an on-disk format, not an implementation.
This patch just adds support for it using the existing filesystem layer
encryption.  A later patch will add support for inline encryption.

Reviewed-by: Paul Crowley <paulcrowley@google.com>
Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
2019-11-06 12:34:36 -08:00
..
caching Documentation: Use "while" instead of "whilst" 2018-11-20 09:30:43 -07:00
cifs various cifs/smb3 fixes (including for share deleted cases) and features including improved encrypted read performance, and various debugging improvements 2019-09-19 10:32:16 -07:00
configfs configfs: fix wrong name of struct in documentation 2018-12-20 08:41:38 -07:00
ext4 Added new ext4 debugging ioctls to allow userspace to get information 2019-09-21 13:37:39 -07:00
nfs docs: fs: convert docs without extension to ReST 2019-07-31 13:31:05 -06:00
9p.txt
adfs.txt
affs.txt
afs.txt afs: Implement @sys substitution handling 2018-04-09 21:12:31 +01:00
api-summary.rst docs: no structured comments in fs/file_table.c 2019-05-24 15:03:39 -06:00
autofs-mount-control.txt autofs: update mount control expire desription with AUTOFS_EXP_FORCED 2019-05-14 19:52:50 -07:00
autofs.txt autofs: add description of ignore pseudo mount option 2019-05-14 19:52:50 -07:00
automount-support.txt autofs: use autofs instead of autofs4 in documentation 2018-06-07 17:34:39 -07:00
befs.txt
bfs.txt
btrfs.txt
ceph.txt ceph: auto reconnect after blacklisted 2019-09-16 12:06:24 +02:00
coda.txt coda: Fix typo in the struct CodaCred documentation 2019-07-30 14:19:41 -06:00
cramfs.txt
dax.txt Documentation: filesystem: Convert xfs.txt to ReST 2019-07-15 09:15:09 -07:00
debugfs.txt debugfs: make debugfs_create_u32_array() return void 2019-06-03 16:34:27 +02:00
devpts.txt
directory-locking.rst docs: fs: convert docs without extension to ReST 2019-07-31 13:31:05 -06:00
dlmfs.txt
dnotify.txt
ecryptfs.txt
efivarfs.txt
erofs.txt erofs: kill use_vmap module parameter 2019-09-05 20:10:09 +02:00
ext2.txt doc: ext2: update description of quota options for ext2 2019-05-20 10:50:48 +02:00
ext3.txt
f2fs.txt f2fs: add missing documents of reserve_root/resuid/resgid 2019-09-06 16:18:26 -07:00
fiemap.txt
files.txt
fscrypt.rst fscrypt: add support for IV_INO_LBLK_64 policies 2019-11-06 12:34:36 -08:00
fsverity.rst fs-verity: add a documentation file 2019-07-28 16:59:15 -07:00
fuse-io.txt fuse: add writeback documentation 2018-03-20 17:11:45 +01:00
fuse.txt
gfs2-glocks.txt GFS2: Minor improvements to comments and documentation 2018-04-12 10:07:51 -07:00
gfs2-uevents.txt
gfs2.txt
hfs.txt
hfsplus.txt
hpfs.txt
index.rst add virtio-fs 2019-09-27 15:54:24 -07:00
inotify.txt
isofs.txt
journalling.rst docs: Bring some order to filesystem documentation 2019-03-06 09:46:10 -07:00
locking.rst docs: fs: convert docs without extension to ReST 2019-07-31 13:31:05 -06:00
locks.txt
mandatory-locking.txt locks: print a warning when mount fails due to lack of "mand" support 2019-08-16 12:13:48 -04:00
mount_api.txt vfs: Update mount API docs 2019-03-28 08:54:20 -07:00
nilfs2.txt
ntfs.txt
ocfs2-online-filecheck.txt
ocfs2.txt
omfs.txt
orangefs.txt Orangefs: documentation updates 2018-04-04 14:05:48 -04:00
overlayfs.txt ovl: fix regression caused by overlapping layers detection 2019-07-16 13:23:40 +02:00
path-lookup.rst docs: Bring some order to filesystem documentation 2019-03-06 09:46:10 -07:00
path-lookup.txt
porting.rst docs: fs: porting.rst: fix a broken reference to another doc 2019-07-31 14:30:23 -06:00
proc.txt mm: thp: fix false negative of shmem vma's THP eligibility 2019-07-18 17:08:06 -07:00
qnx6.txt Documentation: Use "while" instead of "whilst" 2018-11-20 09:30:43 -07:00
quota.txt
ramfs-rootfs-initramfs.txt docs: early-userspace: move to driver-api guide 2019-07-15 11:03:01 -03:00
relay.txt Documentation : Update relay function types 2018-07-10 15:11:00 -06:00
romfs.txt
seq_file.txt fs/seq_file.c: simplify seq_file iteration code and interface 2018-08-17 16:20:28 -07:00
sharedsubtree.txt
splice.rst docs: Bring some order to filesystem documentation 2019-03-06 09:46:10 -07:00
spufs.txt Documentation: fix spelling mistake, EACCESS -> EACCES 2018-11-07 15:28:55 -07:00
squashfs.txt
sysfs-pci.txt
sysfs-tagging.txt
sysfs.txt docs: driver-model: move it to the driver-api book 2019-07-15 11:03:02 -03:00
sysv-fs.txt
tmpfs.txt docs: cgroup-v1: add it to the admin-guide book 2019-07-15 11:03:02 -03:00
ubifs-authentication.rst docs: ubifs-authentication.md: convert to ReST 2019-07-31 13:25:22 -06:00
ubifs.txt ubifs: Enable authentication support 2018-10-23 13:49:01 +02:00
udf.txt udf: Remove never implemented mount options 2018-02-27 10:25:33 +01:00
vfat.txt
vfs.rst docs: fs: convert docs without extension to ReST 2019-07-31 13:31:05 -06:00
virtiofs.rst virtio-fs: add Documentation/filesystems/virtiofs.rst 2019-09-18 15:09:34 +02:00
xfs-delayed-logging-design.txt Documentation: xfs: Fix typo 2019-06-07 11:42:20 -06:00
xfs-self-describing-metadata.txt xfs: add struct xfs_mount pointer to struct xfs_buf 2019-06-28 19:27:29 -07:00