From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89E3DC433EF for ; Fri, 12 Nov 2021 19:12:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3159D60EFD for ; Fri, 12 Nov 2021 19:12:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3159D60EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id AAA036B0075; Fri, 12 Nov 2021 14:12:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A59F66B0078; Fri, 12 Nov 2021 14:12:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 906056B007B; Fri, 12 Nov 2021 14:12:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id 7E3946B0075 for ; Fri, 12 Nov 2021 14:12:13 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2FA0C1853B967 for ; Fri, 12 Nov 2021 19:12:13 +0000 (UTC) X-FDA: 78801223746.23.97F870F Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP id 4473AF0003B5 for ; Fri, 12 Nov 2021 19:12:12 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 14A5C60E08; Fri, 12 Nov 2021 19:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636744331; bh=wOUilmJG0yEgl1+k5Dv+lHJaSa6UoZ46IqfGRu9V9XQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X7FNpIsZPHPlPoIgaaUHCqxHG7T4VxQwOupFwalBJqQi0gFy2oU2SbJ8935bY/cF+ 9kVFwQ2YDAbV1gk/1jTM0OVZpDzSFwNERoAH0rq4uT9rBQUy/QMnBmGRAhIYAuKgNm h8ybUFxujrye+TLVBFWUoqELZUnY+Q134eMTiCoEiBmAMBUSn3jBUB6nIk8JFRSH51 PDB49vG+Ku47WfCQL3K0u/tYafjvvas67C1ko9aHEUAraiW/YyBHr/saBP6GUOH4iG uoPF9+5Hh3yyMMS0mwC9OxevB/gqj1wYaUZKSL/huR+sElTevY/BFtFv8uDEc1AoS8 rMrSWUvuPVYmg== Date: Fri, 12 Nov 2021 11:12:09 -0800 From: Eric Biggers To: Roberto Sassu Cc: tytso@mit.edu, corbet@lwn.net, viro@zeniv.linux.org.uk, hughd@google.com, akpm@linux-foundation.org, linux-fscrypt@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH 5/5] shmem: Add fsverity support Message-ID: References: <20211112124411.1948809-1-roberto.sassu@huawei.com> <20211112124411.1948809-6-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211112124411.1948809-6-roberto.sassu@huawei.com> Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=X7FNpIsZ; spf=pass (imf17.hostedemail.com: domain of ebiggers@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=ebiggers@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4473AF0003B5 X-Stat-Signature: bc4od3njfme1ojaguo7o96hnp9uqnfy5 X-HE-Tag: 1636744332-961347 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 12, 2021 at 01:44:11PM +0100, Roberto Sassu wrote: > Make the necessary modifications to support fsverity in tmpfs. > > First, implement the fsverity operations (in a similar way of f2fs). These > operations make use of shmem_read_mapping_page() instead of > read_mapping_page() to handle the case where the page has been swapped out. > The fsverity descriptor is placed at the end of the file and its location > is stored in an xattr. > > Second, implement the ioctl operations to enable, measure and read fsverity > metadata. > > Lastly, add calls to fsverity functions, to ensure that fsverity-relevant > operations are checked and handled by fsverity (file open, attr set, inode > evict). > > Fsverity support can be enabled through the kernel configuration and > remains enabled by default for every tmpfs filesystem instantiated (there > should be no overhead, unless fsverity is enabled for a file). > > Signed-off-by: Roberto Sassu I don't see how this makes sense at all. The point of fs-verity is to avoid having to hash the whole file when verifying it. However, obviously the whole file still has to be hashed to build the Merkle tree in the first place. That makes sense for a persistent filesystem where a file can be written once and verified many times. I don't see how it makes sense for tmpfs, where files have to be re-created on every boot. You might as well just hash the whole file. Also, you didn't implement actually verifying the data (by calling fsverity_verify_page()), so this patch doesn't really do anything anyway. - Eric