fs-verity: add data verification hooks for ->readpages()

Add functions that verify data pages that have been read from a
fs-verity file, against that file's Merkle tree.  These will be called
from filesystems' ->readpage() and ->readpages() methods.

Since data verification can block, a workqueue is provided for these
methods to enqueue verification work from their bio completion callback.

See the "Verifying data" section of
Documentation/filesystems/fsverity.rst for more information.

Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers
2019-07-22 09:26:22 -07:00
parent c1d9b584e2
commit 8a1d0f9cac
6 changed files with 352 additions and 1 deletions

View File

@@ -41,7 +41,15 @@ static int __init fsverity_init(void)
if (err)
return err;
err = fsverity_init_workqueue();
if (err)
goto err_exit_info_cache;
pr_debug("Initialized fs-verity\n");
return 0;
err_exit_info_cache:
fsverity_exit_info_cache();
return err;
}
late_initcall(fsverity_init)