e2fsprogs/po/POTFILES.in
Eric Biggers 2ba05753f7 e2fsck: check for consistent encryption policies
By design, the kernel enforces that all files in an encrypted directory
use the same encryption policy as the directory.  It's not possible to
violate this constraint using syscalls.  Lookups of files that violate
this constraint also fail, in case the disk was manipulated.

But this constraint can also be violated by accidental filesystem
corruption.  E.g., a power cut when using ext4 without a journal might
leave new files without the encryption bit and/or xattr.  Thus, it's
important that e2fsck correct this condition.

Therefore, this patch makes the following changes to e2fsck:

- During pass 1 (inode table scan), create a map from inode number to
  encryption policy for all encrypted inodes.  But it's optimized so
  that the full xattrs aren't saved but rather only 32-bit "policy IDs",
  since usually many inodes share the same encryption policy.  Also, if
  an encryption xattr is missing, offer to clear the encrypt flag.  If
  an encryption xattr is clearly corrupt, offer to clear the inode.

- During pass 2 (directory structure check), use the map to verify that
  all regular files, directories, and symlinks in encrypted directories
  use the directory's encryption policy.  Offer to clear any directory
  entries for which this isn't the case.

Add a new test "f_bad_encryption" to test the new behavior.

Due to the new checks, it was also necessary to update the existing test
"f_short_encrypted_dirent" to add an encryption xattr to the test file,
since it was missing one before, which is now considered invalid.

Google-Bug-Id: 135138675
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
2019-10-09 20:18:20 -04:00

72 lines
1.2 KiB
Plaintext

e2fsck/badblocks.c
e2fsck/dirinfo.c
e2fsck/dx_dirinfo.c
e2fsck/e2fsck.c
e2fsck/ea_refcount.c
e2fsck/ehandler.c
e2fsck/emptydir.c
e2fsck/encrypted_files.c
e2fsck/extend.c
e2fsck/extents.c
e2fsck/flushb.c
e2fsck/iscan.c
e2fsck/journal.c
e2fsck/logfile.c
e2fsck/message.c
e2fsck/mtrace.c
e2fsck/pass1b.c
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/pass3.c
e2fsck/pass4.c
e2fsck/pass5.c
e2fsck/problem.c
e2fsck/quota.c
e2fsck/readahead.c
e2fsck/recovery.c
e2fsck/region.c
e2fsck/rehash.c
e2fsck/revoke.c
e2fsck/scantest.c
e2fsck/sigcatcher.c
e2fsck/super.c
e2fsck/unix.c
e2fsck/util.c
misc/badblocks.c
misc/base_device.c
misc/blkid.c
misc/chattr.c
misc/create_inode.c
misc/dumpe2fs.c
misc/e2freefrag.c
misc/e2fuzz.c
misc/e2image.c
misc/e2initrd_helper.c
misc/e2label.c
misc/e2undo.c
misc/e4crypt.c
misc/e4defrag.c
misc/filefrag.c
misc/findsuper.c
misc/fsck.c
misc/fuse2fs.c
misc/ismounted.c
misc/logsave.c
misc/lsattr.c
misc/mke2fs.c
misc/mk_hugefiles.c
misc/mklost+found.c
misc/partinfo.c
misc/tune2fs.c
misc/util.c
misc/uuidd.c
misc/uuidgen.c
resize/extent.c
resize/main.c
resize/online.c
resize/resize2fs.c
resize/sim_progress.c
lib/ext2fs/ext2_err.c
lib/support/prof_err.c
lib/support/plausible.c