]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ext4: require key for truncate(2) of encrypted file
authorEric Biggers <ebiggers@google.com>
Fri, 23 Jun 2017 23:48:44 +0000 (19:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Jun 2017 23:48:44 +0000 (19:48 -0400)
commit63136858aecbe86dbd3c3289a3f46ba1b5f92239
treeed24bdb2cee0c087bde6737539358856c8b3249a
parent66e0aaadce7fc99e91e0b427e2b177e14d0b951b
ext4: require key for truncate(2) of encrypted file

Currently, filesystems allow truncate(2) on an encrypted file without
the encryption key.  However, it's impossible to correctly handle the
case where the size being truncated to is not a multiple of the
filesystem block size, because that would require decrypting the final
block, zeroing the part beyond i_size, then encrypting the block.

As other modifications to encrypted file contents are prohibited without
the key, just prohibit truncate(2) as well, making it fail with ENOKEY.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c