Re: [PATCH 11/13] fsverity: report validation errors back to the filesystem

Eric Biggers
2024-04-05T03:09:14Z

On Fri, Mar 29, 2024 at 05:35:32PM -0700, Darrick J. Wong wrote:
> + /**
> + * Notify the filesystem that file data validation failed
> + *
> + * @inode: the inode being validated
> + * @pos: the file position of the invalid data
> + * @len: the length of the invalid data
> + *
> + * This is called when fs-verity cannot validate the file contents.
> + */
> + void (*fail_validation)(struct inode *inode, loff_t pos, size_t len);

There is a difference between the file actually being corrupt (mismatching
hashes) and other problems like disk errors reading from the Merkle tree.
"Validation failed" is a bit ambiguous, and "cannot validate the file contents"
even more so. Do you want only file corruption errors? If so it may be a good
idea to call this 'file_corrupt', which would be consistent with the
"FILE CORRUPTED" error message in fs/verity/verify.c. Or do you actually want
all errors? Either way, it needs to be clarified what is actually meant.

- Eric