linux-stable/Documentation/filesystems
Eric Biggers 93edd392ca fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY
Extend the FS_IOC_ADD_ENCRYPTION_KEY ioctl to allow the raw key to be
specified by a Linux keyring key, rather than specified directly.

This is useful because fscrypt keys belong to a particular filesystem
instance, so they are destroyed when that filesystem is unmounted.
Usually this is desired.  But in some cases, userspace may need to
unmount and re-mount the filesystem while keeping the keys, e.g. during
a system update.  This requires keeping the keys somewhere else too.

The keys could be kept in memory in a userspace daemon.  But depending
on the security architecture and assumptions, it can be preferable to
keep them only in kernel memory, where they are unreadable by userspace.

We also can't solve this by going back to the original fscrypt API
(where for each file, the master key was looked up in the process's
keyring hierarchy) because that caused lots of problems of its own.

Therefore, add the ability for FS_IOC_ADD_ENCRYPTION_KEY to accept a
Linux keyring key.  This solves the problem by allowing userspace to (if
needed) save the keys securely in a Linux keyring for re-provisioning,
while still using the new fscrypt key management ioctls.

This is analogous to how dm-crypt accepts a Linux keyring key, but the
key is then stored internally in the dm-crypt data structures rather
than being looked up again each time the dm-crypt device is accessed.

Use a custom key type "fscrypt-provisioning" rather than one of the
existing key types such as "logon".  This is strongly desired because it
enforces that these keys are only usable for a particular purpose: for
fscrypt as input to a particular KDF.  Otherwise, the keys could also be
passed to any kernel API that accepts a "logon" key with any service
prefix, e.g. dm-crypt, UBIFS, or (recently proposed) AF_ALG.  This would
risk leaking information about the raw key despite it ostensibly being
unreadable.  Of course, this mistake has already been made for multiple
kernel APIs; but since this is a new API, let's do it right.

This patch has been tested using an xfstest which I wrote to test it.

Link: https://lore.kernel.org/r/20191119222447.226853-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2019-12-31 10:33:49 -06:00
..
caching
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
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
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.rst docs: filesystems: Add mount map description in Content 2019-11-18 12:19:59 -07:00
automount-support.txt
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: Add debugfs_create_xul() for hexadecimal unsigned long 2019-11-03 18:08:53 +01: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: update documentation 2019-12-08 21:37:01 +08: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: expose main_blkaddr in sysfs 2019-11-25 10:01:27 -08:00
fiemap.txt
files.txt
fscrypt.rst fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY 2019-12-31 10:33:49 -06:00
fsverity.rst docs: fs-verity: mention statx() support 2019-11-13 12:15:34 -08:00
fuse-io.txt
fuse.txt
gfs2-glocks.txt
gfs2-uevents.txt
gfs2.txt
hfs.txt
hfsplus.txt
hpfs.txt
index.rst docs: filesystems: convert autofs.txt to reST 2019-11-18 12:17:17 -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 Documentation: atomic_open called with shared lock on non-O_CREAT open 2019-11-07 13:17:25 -07: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
overlayfs.rst docs: filesystems: overlayfs: Fix restview warnings 2019-12-10 16:00:55 +01: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
quota.txt
ramfs-rootfs-initramfs.txt docs: early-userspace: move to driver-api guide 2019-07-15 11:03:01 -03:00
relay.txt
romfs.txt
seq_file.txt
sharedsubtree.txt
splice.rst docs: Bring some order to filesystem documentation 2019-03-06 09:46:10 -07:00
spufs.txt
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
udf.txt
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