1
0
Fork 0
alistair23-linux/fs/ext4
Eric Biggers 9ce0151a47 ext4: forbid encrypting root directory
Currently it's possible to encrypt all files and directories on an ext4
filesystem by deleting everything, including lost+found, then setting an
encryption policy on the root directory.  However, this is incompatible
with e2fsck because e2fsck expects to find, create, and/or write to
lost+found and does not have access to any encryption keys.  Especially
problematic is that if e2fsck can't find lost+found, it will create it
without regard for whether the root directory is encrypted.  This is
wrong for obvious reasons, and it causes a later run of e2fsck to
consider the lost+found directory entry to be corrupted.

Encrypting the root directory may also be of limited use because it is
the "all-or-nothing" use case, for which dm-crypt can be used instead.
(By design, encryption policies are inherited and cannot be overridden;
so the root directory having an encryption policy implies that all files
and directories on the filesystem have that same encryption policy.)

In any case, encrypting the root directory is broken currently and must
not be allowed; so start returning an error if userspace requests it.
For now only do this in ext4, because f2fs and ubifs do not appear to
have the lost+found requirement.  We could move it into
fscrypt_ioctl_set_policy() later if desired, though.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
2017-06-23 00:10:36 -04:00
..
Kconfig dax: fix build warnings with FS_DAX and !FS_IOMAP 2017-01-24 16:26:14 -08:00
Makefile ext4: support GETFSMAP ioctls 2017-04-30 00:36:53 -04:00
acl.c ext4: xattr inode deduplication 2017-06-22 11:44:55 -04:00
acl.h ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
balloc.c The major change this cycle is deleting ext4's copy of the file system 2016-07-26 18:35:55 -07:00
bitmap.c ext4: remove unused header files 2015-04-02 23:47:42 -04:00
block_validity.c ext4: add missing KERN_CONT to a few more debugging uses 2016-10-15 09:57:31 -04:00
dir.c ext4: remove unused variable 2016-09-30 02:14:56 -04:00
ext4.h ext4: send parallel discards on commit completions 2017-06-22 23:54:33 -04:00
ext4_extents.h ext4: fix misspellings in comments. 2016-03-09 23:49:05 -05:00
ext4_jbd2.c ext4: add shutdown bit and check for it 2017-02-05 01:28:48 -05:00
ext4_jbd2.h ext4: improve journal credit handling in set xattr paths 2017-06-21 22:28:40 -04:00
extents.c ext4: call journal revoke when freeing ea_inode blocks 2017-06-21 21:36:51 -04:00
extents_status.c scripts/spelling.txt: add "comsume(r)" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
extents_status.h ext4: move procfs registration code to fs/ext4/sysfs.c 2015-09-23 12:46:17 -04:00
file.c ext4: fix off-by-one on max nr_pages in ext4_find_unwritten_pgoff() 2017-05-24 18:02:20 -04:00
fsmap.c ext4: support GETFSMAP ioctls 2017-04-30 00:36:53 -04:00
fsmap.h ext4: support GETFSMAP ioctls 2017-04-30 00:36:53 -04:00
fsync.c ext4: add shutdown bit and check for it 2017-02-05 01:28:48 -05:00
hash.c ext4: move halfmd4 into hash.c directly 2017-02-02 11:52:14 -05:00
ialloc.c ext4: do not set posix acls on xattr inodes 2017-06-21 21:21:39 -04:00
indirect.c ext4: call journal revoke when freeing ea_inode blocks 2017-06-21 21:36:51 -04:00
inline.c ext4: xattr-in-inode support 2017-06-21 21:10:32 -04:00
inode.c ext4: avoid unnecessary stalls in ext4_evict_inode() 2017-06-22 23:49:46 -04:00
ioctl.c quota: add get_inode_usage callback to transfer multi-inode charges 2017-06-22 11:46:48 -04:00
mballoc.c ext4: send parallel discards on commit completions 2017-06-22 23:54:33 -04:00
mballoc.h ext4: send parallel discards on commit completions 2017-06-22 23:54:33 -04:00
migrate.c ext4: do not set posix acls on xattr inodes 2017-06-21 21:21:39 -04:00
mmp.c block,fs: use REQ_* flags directly 2016-11-01 09:43:26 -06:00
move_extent.c ext4: add ext4_is_quota_file() 2017-06-22 11:31:25 -04:00
namei.c ext4: add largedir feature 2017-06-21 21:09:57 -04:00
page-io.c ext4: replace BUG_ON with WARN_ONCE in ext4_end_bio() 2017-04-30 20:08:05 -04:00
readpage.c Merge branch 'akpm' (patches from Andrew) 2016-07-26 19:55:54 -07:00
resize.c ext4: rename s_resize_flags to s_ext4_flags 2017-02-05 01:27:48 -05:00
super.c ext4: forbid encrypting root directory 2017-06-23 00:10:36 -04:00
symlink.c ext4: Add statx support 2017-04-03 01:05:58 -04:00
sysfs.c ext4: constify static data that is never modified 2017-04-29 23:47:50 -04:00
truncate.h ext4: fix races between page faults and hole punching 2015-12-07 14:28:03 -05:00
xattr.c ext4: add nombcache mount option 2017-06-22 11:55:14 -04:00
xattr.h quota: add get_inode_usage callback to transfer multi-inode charges 2017-06-22 11:46:48 -04:00
xattr_security.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_trusted.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_user.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00