From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:56236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752416AbdFNMov (ORCPT ); Wed, 14 Jun 2017 08:44:51 -0400 Subject: Re: [f2fs-dev] [PATCH 2/3] f2fs: require key for truncate(2) of encrypted file To: Eric Biggers , linux-fscrypt@vger.kernel.org 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 References: <20170613234755.111167-1-ebiggers3@gmail.com> <20170613234755.111167-3-ebiggers3@gmail.com> From: Chao Yu Message-ID: Date: Wed, 14 Jun 2017 20:44:19 +0800 MIME-Version: 1.0 In-Reply-To: <20170613234755.111167-3-ebiggers3@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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,