From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Yu Subject: Re: [PATCH 2/3] f2fs: require key for truncate(2) of encrypted file Date: Wed, 14 Jun 2017 20:44:19 +0800 Message-ID: References: <20170613234755.111167-1-ebiggers3@gmail.com> <20170613234755.111167-3-ebiggers3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Theodore Ts'o , Eric Biggers , linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org To: Eric Biggers , linux-fscrypt@vger.kernel.org Return-path: In-Reply-To: <20170613234755.111167-3-ebiggers3@gmail.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net List-Id: linux-ext4.vger.kernel.org On 2017/6/14 7:47, Eric Biggers wrote: > From: Eric Biggers > > 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 Acked-by: Chao Yu Thanks, ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot