Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2221448/?format=api
{ "id": 2221448, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2221448/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260409131404.1545834-5-aalbersh@kernel.org/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.2/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260409131404.1545834-5-aalbersh@kernel.org>", "list_archive_url": null, "date": "2026-04-09T13:13:36", "name": "[v7,04/22] fsverity: generate and store zero-block hash", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "bd52491f4444b8dd6b2c669ebad2d434b9260b83", "submitter": { "id": 92821, "url": "http://patchwork.ozlabs.org/api/1.2/people/92821/?format=api", "name": "Andrey Albershteyn", "email": "aalbersh@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260409131404.1545834-5-aalbersh@kernel.org/mbox/", "series": [ { "id": 499292, "url": "http://patchwork.ozlabs.org/api/1.2/series/499292/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=499292", "date": "2026-04-09T13:13:34", "name": "fs-verity support for XFS with post EOF merkle tree", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/499292/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2221448/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2221448/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=ximq=CI=vger.kernel.org=linux-ext4+bounces-15701-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=N+4GpqYM;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=ximq=ci=vger.kernel.org=linux-ext4+bounces-15701-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.105.105.114 arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=N+4GpqYM;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15701-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"N+4GpqYM\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fs0rP4VD4z1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 23:19:01 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fs0rP42jPz4wL4\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 23:19:01 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fs0rP3yvwz4wSp; Thu, 09 Apr 2026 23:19:01 +1000 (AEST)", "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fs0rL0hXqz4wL4\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 09 Apr 2026 23:18:58 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id C0A6630562AC\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 9 Apr 2026 13:15:05 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 08AED3D092D;\n\tThu, 9 Apr 2026 13:14:24 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 937793D0930;\n\tThu, 9 Apr 2026 13:14:23 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 8C29CC4CEF7;\n\tThu, 9 Apr 2026 13:14:20 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775740741; cv=pass;\n\tb=t6xOzE3qdg1EXCTesH7yQOn7ljI84s7HoHGNtH+A3PybfFQPaWejLWtHerTuXYIWpMR1tLAuFjZ9l+7S317i8ILy6cJypRNtDusGxEjFE+KdycTw+4JUaXIcHqsWr1ugIZXbcF49SWi/ar+YIEv3vtn065j5NmDLE3eax9Dhd5nzxpsrYnXc3dN0MJQg5FGKYYY7gXYfuyn4O76wG+q83k7V+WJqpXf2N+yGsEJiB5ApgGqmJ+4XdmLjGsTAG+NhlbkSl/4W8Es6NWj89C/2XfjRnzP4eFWbeDwBC1BRi9uwr5OgU//eHw9K8HTix6dTMz6XmH1K8fW+m8t/0tBikQ==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775740463; cv=none;\n b=WYRkwIAKPGEQKYVrLPV8/RRrAB41HCcCb2zogYppoMlcJVCJ6EUA3FDbtlIWJ8XdfAzjTcSImswCRajKLRgk8qVnHk4JfwAnK5i/0D44Z0dC8naMtqkXHCUMRyjV+p2qZ7rIlyunTQ85rq+glQEROpaz5yLh1FYTpxJX9+Y0i3s=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775740741; c=relaxed/relaxed;\n\tbh=NvBByjh2VJQ7E47QHKQUXSYu2um1tWZGSXmhmufwQ6A=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=ZuVlsP69jgvZGOpUBQLbDD8TEeR8z/iw/hRsAzkrNWZT23wYwzLScNGd0NxV4xcb3q764PYHCyoYD+3/jkgfWL6cq7rRYKJk1vqKwUSPUNNcjD+AR9J+MtDwM2TPDk0B6jSfQV5aLWtLt+RUYk1vHwt1dl4UYTKrDceXN00Ljyv5xFtvK6SSAEm6Xdg1CkowQ6CjIJ5tHF/QAJtyQ9WvQVf9VhJ9GjcKkvOQBYg4WomRVk5gBiSA9VZEb4Oxqs1mp5QIeqRjk4BY7gTi4k0NlT8hrrSAV/ylqgn3bGmtU3ysdLWQldiQhotuVfEtxXnJim2HrlaOrwX0EvUJv+2itA==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775740463; c=relaxed/simple;\n\tbh=R9xmYqpzgIFigojr0fKbrRlBCOLoFi0C2ZAyyNYRUGM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=pYMOkQu7hC4b8M1cE22b8pm3qrSGwxyNIG3NpOg9Iqw2hG7ruphSqhzCwYkrZAptu3GE5t7tALSM4Hc8mtjjQnNbnT/56tlsd2RhpJz0wSGpts8qGkGhlx669mzrfLELuxsTJY3m9IUO6KD3BddJht3+IfTKR3K/7Kajv6i1PIQ=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=N+4GpqYM; dkim-atps=neutral;\n spf=pass (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15701-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=N+4GpqYM; arc=none smtp.client-ip=10.30.226.201" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775740463;\n\tbh=R9xmYqpzgIFigojr0fKbrRlBCOLoFi0C2ZAyyNYRUGM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=N+4GpqYMpCa77QHI2jc01o/xgt9IIbE6WntWpjngj5XLvNAKvBbnc/H1Mbv46iwyS\n\t Br4UJyOzX+fMFRHgADyerQHz3H5JyLpnQw8msI2tBWd4MQWOqfngWFnf95NS8JUJpU\n\t b1h9KNoNDX6viKe5IW6vkocmLP8FAqGn5lFDBYUuDpcPQt+GBByLaOOAQ+yrpPFb3G\n\t RddDtW/p2Fx23jKUGJ3lsUKX+krQkr8Iv0XIkiuhCsm9EHIDqHCX0MqxN921KPD2cA\n\t dzL59lstSBuq1yp0XHqouaPDu+3bVU9HlmCr+K0MbdIzBhQM+XA1Qn1mb/yHpK1bVg\n\t oOYKqix9G0vLQ==", "From": "Andrey Albershteyn <aalbersh@kernel.org>", "To": "linux-xfs@vger.kernel.org,\n\tfsverity@lists.linux.dev,\n\tlinux-fsdevel@vger.kernel.org,\n\tebiggers@kernel.org", "Cc": "Andrey Albershteyn <aalbersh@kernel.org>,\n\thch@lst.de,\n\tlinux-ext4@vger.kernel.org,\n\tlinux-f2fs-devel@lists.sourceforge.net,\n\tlinux-btrfs@vger.kernel.org,\n\tdjwong@kernel.org", "Subject": "[PATCH v7 04/22] fsverity: generate and store zero-block hash", "Date": "Thu, 9 Apr 2026 15:13:36 +0200", "Message-ID": "<20260409131404.1545834-5-aalbersh@kernel.org>", "X-Mailer": "git-send-email 2.51.2", "In-Reply-To": "<20260409131404.1545834-1-aalbersh@kernel.org>", "References": "<20260409131404.1545834-1-aalbersh@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "Compute the hash of one filesystem block's worth of zeros. A filesystem\nimplementation can decide to elide merkle tree blocks containing only\nthis hash and synthesize the contents at read time.\n\nLet's pretend that there's a file containing 131 data block and whose\nmerkle tree looks roughly like this:\n\nroot\n +--leaf0\n | +--data0\n | +--data1\n | +--...\n | `--data128\n `--leaf1\n +--data129\n +--data130\n `--data131\n\nIf data[0-128] are sparse holes, then leaf0 will contain a repeating\nsequence of @zero_digest. Therefore, leaf0 need not be written to disk\nbecause its contents can be synthesized.\n\nA subsequent xfs patch will use this to reduce the size of the merkle\ntree when dealing with sparse gold master disk images and the like.\n\nNote that this works only on the first-level (data holes). fsverity\ndoesn't store/generate zero_digest for any higher levels.\n\nAdd a helper to pre-fill folio with hashes of empty blocks. This will be\nused by iomap to synthesize blocks full of zero hashes on the fly.\n\nSigned-off-by: Darrick J. Wong <djwong@kernel.org>\nAcked-by: Eric Biggers <ebiggers@kernel.org>\nSigned-off-by: Andrey Albershteyn <aalbersh@kernel.org>\n---\n fs/verity/fsverity_private.h | 3 +++\n fs/verity/measure.c | 4 ++--\n fs/verity/open.c | 3 +++\n fs/verity/pagecache.c | 22 ++++++++++++++++++++++\n include/linux/fsverity.h | 8 ++++++++\n 5 files changed, 38 insertions(+), 2 deletions(-)", "diff": "diff --git a/fs/verity/fsverity_private.h b/fs/verity/fsverity_private.h\nindex 6e6854c19078..881d46f25e08 100644\n--- a/fs/verity/fsverity_private.h\n+++ b/fs/verity/fsverity_private.h\n@@ -53,6 +53,9 @@ struct merkle_tree_params {\n \tu64 tree_size;\t\t\t/* Merkle tree size in bytes */\n \tunsigned long tree_pages;\t/* Merkle tree size in pages */\n \n+\t/* the hash of an all-zeroes block */\n+\tu8 zero_digest[FS_VERITY_MAX_DIGEST_SIZE];\n+\n \t/*\n \t * Starting block index for each tree level, ordered from leaf level (0)\n \t * to root level ('num_levels - 1')\ndiff --git a/fs/verity/measure.c b/fs/verity/measure.c\nindex 6a35623ebdf0..818083507885 100644\n--- a/fs/verity/measure.c\n+++ b/fs/verity/measure.c\n@@ -68,8 +68,8 @@ EXPORT_SYMBOL_GPL(fsverity_ioctl_measure);\n * @alg: (out) the digest's algorithm, as a FS_VERITY_HASH_ALG_* value\n * @halg: (out) the digest's algorithm, as a HASH_ALGO_* value\n *\n- * Retrieves the fsverity digest of the given file. The file must have been\n- * opened at least once since the inode was last loaded into the inode cache;\n+ * Retrieves the fsverity digest of the given file. The\n+ * fsverity_ensure_verity_info() must be called on the inode beforehand;\n * otherwise this function will not recognize when fsverity is enabled.\n *\n * The file's fsverity digest consists of @raw_digest in combination with either\ndiff --git a/fs/verity/open.c b/fs/verity/open.c\nindex d32d0899df25..875e8850ccba 100644\n--- a/fs/verity/open.c\n+++ b/fs/verity/open.c\n@@ -153,6 +153,9 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params,\n \t\tgoto out_err;\n \t}\n \n+\tfsverity_hash_block(params, page_address(ZERO_PAGE(0)),\n+\t\t\t params->zero_digest);\n+\n \tparams->tree_size = offset << log_blocksize;\n \tparams->tree_pages = PAGE_ALIGN(params->tree_size) >> PAGE_SHIFT;\n \treturn 0;\ndiff --git a/fs/verity/pagecache.c b/fs/verity/pagecache.c\nindex 1819314ecaa3..99f5f53eea98 100644\n--- a/fs/verity/pagecache.c\n+++ b/fs/verity/pagecache.c\n@@ -2,6 +2,7 @@\n /*\n * Copyright 2019 Google LLC\n */\n+#include \"fsverity_private.h\"\n \n #include <linux/export.h>\n #include <linux/fsverity.h>\n@@ -56,3 +57,24 @@ void generic_readahead_merkle_tree(struct inode *inode, pgoff_t index,\n \t\tfolio_put(folio);\n }\n EXPORT_SYMBOL_GPL(generic_readahead_merkle_tree);\n+\n+/**\n+ * fsverity_fill_zerohash() - fill folio with hashes of zero data block\n+ * @folio:\tfolio to fill\n+ * @offset:\toffset in the folio to start\n+ * @len:\tlength of the range to fill with hashes\n+ * @vi:\t\tfsverity info\n+ */\n+void fsverity_fill_zerohash(struct folio *folio, size_t offset, size_t len,\n+\t\t\t struct fsverity_info *vi)\n+{\n+\tsize_t off = offset;\n+\n+\tWARN_ON_ONCE(!IS_ALIGNED(offset, vi->tree_params.digest_size));\n+\tWARN_ON_ONCE(!IS_ALIGNED(len, vi->tree_params.digest_size));\n+\n+\tfor (; off < (offset + len); off += vi->tree_params.digest_size)\n+\t\tmemcpy_to_folio(folio, off, vi->tree_params.zero_digest,\n+\t\t\t\tvi->tree_params.digest_size);\n+}\n+EXPORT_SYMBOL_GPL(fsverity_fill_zerohash);\ndiff --git a/include/linux/fsverity.h b/include/linux/fsverity.h\nindex 5562271bd628..e4503312d114 100644\n--- a/include/linux/fsverity.h\n+++ b/include/linux/fsverity.h\n@@ -201,6 +201,8 @@ bool fsverity_verify_blocks(struct fsverity_info *vi, struct folio *folio,\n \t\t\t size_t len, size_t offset);\n void fsverity_verify_bio(struct fsverity_info *vi, struct bio *bio);\n void fsverity_enqueue_verify_work(struct work_struct *work);\n+void fsverity_fill_zerohash(struct folio *folio, size_t poff, size_t plen,\n+\t\t\t struct fsverity_info *vi);\n \n #else /* !CONFIG_FS_VERITY */\n \n@@ -281,6 +283,12 @@ static inline void fsverity_enqueue_verify_work(struct work_struct *work)\n \tWARN_ON_ONCE(1);\n }\n \n+static inline void fsverity_fill_zerohash(struct folio *folio, size_t poff,\n+\t\tsize_t plen, struct fsverity_info *vi)\n+{\n+\tWARN_ON_ONCE(1);\n+}\n+\n #endif\t/* !CONFIG_FS_VERITY */\n \n static inline bool fsverity_verify_folio(struct fsverity_info *vi,\n", "prefixes": [ "v7", "04/22" ] }