From patchwork Sun Feb 19 20:48:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 59206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1005494wrn; Sun, 19 Feb 2023 13:18:37 -0800 (PST) X-Google-Smtp-Source: AK7set9Vo1RpfBmBeVse6Z5VG3z8bQZba7G6UyfZVUwrBuNsxu3kdDqsilxq4dkv7yAMJprs6TRd X-Received: by 2002:a17:906:86d4:b0:87b:3d29:2982 with SMTP id j20-20020a17090686d400b0087b3d292982mr7688116ejy.11.1676841516989; Sun, 19 Feb 2023 13:18:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676841516; cv=none; d=google.com; s=arc-20160816; b=Dxf0cVUA56i11/1enw4MM/Q+S859REk+FITrFSwpF/IQVyeI6onyF/4xflwG4pTDXF 4Q3hOEITowGrfvBh6YDsmfeCtiA4xEWG3lgbMIvjPe1h21hH2l1KdjvxkWLDrGpJud5J ctOMXnMds+/DVq1vVG7lVOLcltRigRAtaV61KxyC50/zNdafalwmTRZVfdkwhZJngCad 0oIAj8Hj/ohzy08gLvDNqDtKWg9O3BFmIRSL+6TCwKUT8wsFsQnGZ9sf/st1taFdjRpO w0xLv6ljWhXqanivhQobqlwOcMi+PdUKMUNszOc/u46lc/X2qsWDTCI/EBLGHsuY4Bpy 44lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=bIL+gC0ZV1/FdIey5KqDX1HK47h3GensHcWtFAxL880=; b=aBm2gKaXgGs4CelYxFDuSlsejZcTe+zIlpyr8s4BNeRuPsU10oo2JmFIOXJxKivw+R 2JaPcJWwqdFfX/+ANbRj3dyE015PSeWvRjQjr/Fhyi4Jrjx3JcVypUd0jVI/gIDg/Ovt iag/SoFtRRs2lbMIm5X0nRD8mVKbROkLvyCj6MhKli8sj96IAnPcK1RU0drhgzv97zrZ bN4U0m/4v6kyd1krzrTh3OKQY5ZWTlSUVJXZz8uum3LcETS0KC0D2m5eHmQ2hfmINTLW tw5MpZhUZH2a7V78fzpQTVFQKKYJtvpV++YOrSik2ihlbTr8wXWVlHZ41eUdpkza52Kg oGAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oSlao0JM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vf17-20020a170907239100b008b126f9cebasi11266029ejb.228.2023.02.19.13.18.13; Sun, 19 Feb 2023 13:18:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oSlao0JM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231579AbjBSUsh (ORCPT + 99 others); Sun, 19 Feb 2023 15:48:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjBSUsg (ORCPT ); Sun, 19 Feb 2023 15:48:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C26CDE3; Sun, 19 Feb 2023 12:48:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8779A60C5F; Sun, 19 Feb 2023 20:48:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A891DC433D2; Sun, 19 Feb 2023 20:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676839711; bh=pPKAZ01/fvm24mHTwEi4mThE8LjTnMIHE3uOq5HgJ2A=; h=Date:From:To:Cc:Subject:From; b=oSlao0JM5OYo6ACCVQAkZY5Q93HpYAmJpHW43ds1Q+OotpwLMAC3C9/0HAr7TFg3j 6iIScv4Z4TH0wEmaVQkCJdPjTX6g/FquCqjZVYcGvxDH07+RM8m6LDrUySsLDBPuqi kx6b261+A/6sLtqlXctM6FSJAAIPJJv77aUq42aj0pCr5WDIc1kyWj5lhvOVYLkn0r cUh/UmZQFRoSM6xwvOh9KAflYXuOznidceBSBU+f2ggZiirn5X6fhwfMXGWTtNFT8S 6TdKb8FV8xBjDKCf2hVWu6N3Wia/s6Wev2JmhPmVMgbPD47DmxWaULT29NvK4TcFeJ G9byS+5xJ9d0A== Date: Sun, 19 Feb 2023 12:48:29 -0800 From: Eric Biggers To: Linus Torvalds Cc: fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, Theodore Ts'o Subject: [GIT PULL] fsverity updates for 6.3 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758295770148531550?= X-GMAIL-MSGID: =?utf-8?q?1758295770148531550?= The following changes since commit 88603b6dc419445847923fcb7fe5080067a30f98: Linux 6.2-rc2 (2023-01-01 13:53:16 -0800) are available in the Git repository at: https://git.kernel.org/pub/scm/fs/fsverity/linux.git tags/fsverity-for-linus for you to fetch changes up to 51e4e3153ebc32d3280d5d17418ae6f1a44f1ec1: fscrypt: support decrypting data from large folios (2023-01-28 15:10:12 -0800) ---------------------------------------------------------------- Fix the longstanding implementation limitation that fsverity was only supported when the Merkle tree block size, filesystem block size, and PAGE_SIZE were all equal. Specifically, add support for Merkle tree block sizes less than PAGE_SIZE, and make ext4 support fsverity on filesystems where the filesystem block size is less than PAGE_SIZE. Effectively, this means that fsverity can now be used on systems with non-4K pages, at least on ext4. These changes have been tested using the verity group of xfstests, newly updated to cover the new code paths. Also update fs/verity/ to support verifying data from large folios. There's also a similar patch for fs/crypto/, to support decrypting data from large folios, which I'm including in this pull request to avoid a merge conflict between the fscrypt and fsverity branches. There will be a merge conflict in fs/buffer.c with some of the foliation work in the mm tree. Please use the merge resolution from linux-next. ---------------------------------------------------------------- Eric Biggers (19): fsverity: optimize fsverity_file_open() on non-verity files fsverity: optimize fsverity_prepare_setattr() on non-verity files fsverity: optimize fsverity_cleanup_inode() on non-verity files fsverity: pass pos and size to ->write_merkle_tree_block fsverity: remove debug messages and CONFIG_FS_VERITY_DEBUG fsverity: use unsigned long for level_start fsverity: simplify Merkle tree readahead size calculation fsverity: store log2(digest_size) precomputed fsverity: use EFBIG for file too large to enable verity fsverity: replace fsverity_hash_page() with fsverity_hash_block() fsverity: support verification with tree block size < PAGE_SIZE fsverity: support enabling with tree block size < PAGE_SIZE ext4: simplify ext4_readpage_limit() f2fs: simplify f2fs_readpage_limit() fs/buffer.c: support fsverity in block_read_full_folio() ext4: allow verity with fs block size < PAGE_SIZE fsverity.rst: update git repo URL for fsverity-utils fsverity: support verifying data from large folios fscrypt: support decrypting data from large folios Documentation/filesystems/fscrypt.rst | 4 +- Documentation/filesystems/fsverity.rst | 96 +++++---- fs/btrfs/verity.c | 19 +- fs/buffer.c | 72 +++++-- fs/crypto/bio.c | 10 +- fs/crypto/crypto.c | 28 +-- fs/ext4/inode.c | 6 +- fs/ext4/readpage.c | 3 +- fs/ext4/super.c | 5 - fs/ext4/verity.c | 6 +- fs/f2fs/data.c | 3 +- fs/f2fs/verity.c | 6 +- fs/verity/Kconfig | 8 - fs/verity/enable.c | 271 ++++++++++++-------------- fs/verity/fsverity_private.h | 24 +-- fs/verity/hash_algs.c | 24 ++- fs/verity/init.c | 1 - fs/verity/open.c | 163 +++++++++------- fs/verity/signature.c | 2 - fs/verity/verify.c | 346 ++++++++++++++++++++++----------- include/linux/fscrypt.h | 9 +- include/linux/fsverity.h | 93 +++++++-- 22 files changed, 699 insertions(+), 500 deletions(-)