Re: [PATCH v6 01/22] fsverity: report validation errors through fserror to fsnotify

Eric Biggers
2026-04-01T21:19:04Z

On Tue, Mar 31, 2026 at 11:28:02PM +0200, Andrey Albershteyn wrote:
> Reported verification errors to fsnotify through recently added fserror
> interface.
>
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/verity/verify.c | 4 ++++
> 1 file changed, 4 insertions(+)

Acked-by: Eric Biggers <ebiggers@kernel.org>

> if (memchr_inv(dblock->data, 0, params->block_size)) {
> + fserror_report_data_lost(inode, data_pos,
> + params->block_size, GFP_NOFS);
> fsverity_err(inode,
> "FILE CORRUPTED! Data past EOF is not zeroed");
> return false;
> @@ -312,6 +315,7 @@ static bool verify_data_block(struct fsverity_info *vi,
> data_pos, level - 1, params->hash_alg->name, hsize, want_hash,
> params->hash_alg->name, hsize,
> level == 0 ? dblock->real_hash : real_hash);
> + fserror_report_data_lost(inode, data_pos, params->block_size, GFP_NOFS);

The first case does the fserror call first and the log message second,
and the second case does them in the opposite order. I don't think it
matters what the order is, but they should be consistent.

- Eric