Hi all, This patchset introduces fs-verity [5] support for XFS. This implementation utilizes extended attributes to store fs-verity metadata in comparison to ext4/f2fs which store that after EOF. The pages are stored in the remote extended attributes. A few starting points: - The xattr name of a each Merkle tree page is binary - fs-verity doesn't work with multi-page folios yet. Thus, those are disabled when fs-verity is enabled on inode. - Direct path and DAX are disabled for inodes with fs-verity - Pages are verified in iomap's read IO path (offloaded with workqueue) - New ro-compat flag is added as inodes with fs-verity have new on-disk diflag Not yet implemented: - No pre-fetching of Merkle tree pages in the read_merkle_tree_page() - No marking of already verified Merkle tree pages (each read, the whole tree is verified). Preliminary testing: - fstests 1k, 4k - More in-depth testing is on the way :) This patchset depends on Allison's Parent Pointer patchset [1], which introduces binary names for extended attributes. Particularly, patch "[PATCH v6 13/27] xfs: Add xfs_verify_pptr" [3] is needed. The first patch moves setting of large folio support flag to more appropriate location - xfs_setup_inode(), where other flags are set. The second one adds wrapper which would be used when already existing inode is sealed with fs-verity. The rest adds fs-verity support. Allison's Parent Pointer patchset v6: [1]: https://lore.kernel.org/linux-xfs/20221129211242.2689855-1-allison.henderson@xxxxxxxxxx/ Allison's Parent Pointer branch: [2]: https://github.com/allisonhenderson/xfs/tree/xfs_new_pptrsv6 Patch which adds handling of xattr binary names: [3]: https://lore.kernel.org/linux-xfs/20221129211242.2689855-14-allison.henderson@xxxxxxxxxx/ This patchset branch: [4]: https://github.com/alberand/linux/tree/xfs-verity fs-verity docs: [5]: https://www.kernel.org/doc/html/latest/filesystems/fsverity.html I'm looking forward for your comments. Thanks! Andrey Andrey Albershteyn (11): xfs: enable large folios in xfs_setup_inode() pagemap: add mapping_clear_large_folios() wrapper xfs: add attribute type for fs-verity xfs: add fs-verity ro-compat flag xfs: add inode on-disk VERITY flag xfs: initialize fs-verity on file open and cleanup on inode destruction xfs: disable direct read path for fs-verity sealed files xfs: don't enable large folios on fs-verity sealed inode iomap: fs-verity verification on page read xfs: add fs-verity support xfs: add fs-verity ioctls fs/iomap/buffered-io.c | 80 ++++++++++++- fs/xfs/Makefile | 1 + fs/xfs/libxfs/xfs_attr.c | 8 ++ fs/xfs/libxfs/xfs_da_format.h | 5 +- fs/xfs/libxfs/xfs_format.h | 14 ++- fs/xfs/libxfs/xfs_log_format.h | 1 + fs/xfs/libxfs/xfs_sb.c | 2 + fs/xfs/xfs_file.c | 22 +++- fs/xfs/xfs_icache.c | 2 - fs/xfs/xfs_inode.c | 2 + fs/xfs/xfs_inode.h | 1 + fs/xfs/xfs_ioctl.c | 11 ++ fs/xfs/xfs_iops.c | 9 ++ fs/xfs/xfs_mount.h | 2 + fs/xfs/xfs_super.c | 12 ++ fs/xfs/xfs_trace.h | 1 + fs/xfs/xfs_verity.c | 203 +++++++++++++++++++++++++++++++++ fs/xfs/xfs_verity.h | 19 +++ fs/xfs/xfs_xattr.c | 3 + include/linux/iomap.h | 5 + include/linux/pagemap.h | 5 + 21 files changed, 393 insertions(+), 15 deletions(-) create mode 100644 fs/xfs/xfs_verity.c create mode 100644 fs/xfs/xfs_verity.h -- 2.31.1