From ad7be74b38d83a31cd76c9cdc1bcc4cddbf03bd6 Mon Sep 17 00:00:00 2001 From: Andrey Albershteyn Date: Sat, 3 Oct 2026 00:36:44 +0200 Subject: fsverity: pass digest size and hash of the all-zeroes block to ->write Let filesystem iterate over hashes in the block and check if these are hashes of zeroed data blocks. XFS will use this to decide if it want to store tree block full of these hashes. Signed-off-by: Andrey Albershteyn Reviewed-by: "Darrick J. Wong" Acked-by: Eric Biggers Acked-by: David Sterba Link: https://patch.msgid.link/20261002223705.2175542-4-aalbersh@kernel.org Signed-off-by: Eric Biggers --- include/linux/fsverity.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h index 3c3250f6f272..9e7d946676b9 100644 --- a/include/linux/fsverity.h +++ b/include/linux/fsverity.h @@ -124,6 +124,8 @@ struct fsverity_operations { * @buf: the Merkle tree block to write * @pos: the position of the block in the Merkle tree (in bytes) * @size: the Merkle tree block size (in bytes) + * @zero_digest: the hash of the all-zeroes block + * @digest_size: size of zero_digest, in bytes * * This is only called between ->begin_enable_verity() and * ->end_enable_verity(). @@ -131,7 +133,9 @@ struct fsverity_operations { * Return: 0 on success, -errno on failure */ int (*write_merkle_tree_block)(struct file *file, const void *buf, - u64 pos, unsigned int size); + u64 pos, unsigned int size, + const u8 *zero_digest, + unsigned int digest_size); }; #ifdef CONFIG_FS_VERITY -- cgit v1.2.3