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 Return-path: Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dL7fO-00033T-Dd for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Jun 2017 12:44:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1dL7fL-0008G8-So for linux-f2fs-devel@lists.sourceforge.net; Wed, 14 Jun 2017 12:44:58 +0000 In-Reply-To: <20170613234755.111167-3-ebiggers3@gmail.com> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 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