[PATCH v3 00/28] fs-verity support for XFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Quite a long time passed by from v2 but this is v3 of fs-verity
support in XFS.

This patchset introduces fs-verity [6] support in XFS. This
implementation uses extended attributes to store fs-verity
metadata. The Merkle tree blocks are stored in the remote extended
attributes. The names are offsets into the tree.

A few key points of this patchset:
- fs-verity works with Merkle tree blocks instead of PAGE references
  from filesystem
- Filesystem can supply bio_set and submit_io() to iomap for read
  path
- In XFS, fs-verity metadata is stored in extended attributes
- Verification happens in iomap's read IO path (offloaded to
  workqueue)
- New global XFS workqueue for verification processing
- Direct path and DAX are disabled for inodes with fs-verity
- Inodes with fs-verity have new on-disk diflag
- xfs_attr_get() can return a buffer with an extended attribute
- Each extended attribute has exactly one Merkle tree block
- xfs_buf with Merkle tree block allocates double memory and has
  duplicate of the extended attribute data with leaf headers and
  without
- xfs_buf tracks verified status of merkle tree block

The patchset consist of five parts:
- [1..4]: Patches from Parent Pointer patchset which add binary
          xattr names with a few deps
- [5]: Patch which adds FS_XFLAG_VERITY to make verity exposed as
  extended attribute flag
- [9..10]: Improvements to core fs-verity - mainly switch to blocks
  management instead of pages
- [11..12]: Allow filesystem to provide submit_io() and bio_set in
  read path
- [12..28]: Integration of fs-verity to xfs

Testing:
The patchset is tested with xfstests -g all (with exceptions) on
xfs_1k, xfs_4k, xfs_1k_quota, xfs_4k_quota, ext4_4k, and
ext4_4k_quota. With KMEMLEAK and KASAN enabled. Also, xfs_1k and
xfs_4k on a 64k pages.

Changes from V2:
- FS_XFLAG_VERITY extended attribute flag
- Change fs-verity to use Merkle tree blocks instead of expecting
  PAGE references from filesystem
- Change approach in iomap to filesystem provided bio_set and
  submit_io instead of just callouts to filesystem
- Add possibility for xfs_buf allocate more space for fs-verity
  extended attributes
- Make xfs_attr module to copy fs-verity blocks inside the xfs_buf,
  so XFS can get data without leaf headers
- Add Merkle tree removal for error path
- Makae scrub aware of new dinode flag
Changes from V1:
- Added parent pointer patches for easier testing
- Many issues and refactoring points fixed from the V1 review
- Adjusted for recent changes in fs-verity core (folios, non-4k)
- Dropped disabling of large folios
- Completely new fsverity patches (fix, callout, log_blocksize)
- Change approach to verification in iomap to the same one as in
  write path. Callouts to fs instead of direct fs-verity use.
- New XFS workqueue for post read folio verification
- xfs_attr_get() can return underlying xfs_buf
- xfs_bufs are marked with XBF_VERITY_CHECKED to track verified
  blocks

kernel:
[1]: https://github.com/alberand/linux/tree/fsverity-v3

xfsprogs:
[2]: https://github.com/alberand/xfsprogs/tree/fsverity-v3

xfstests:
[3]: https://github.com/alberand/xfstests/tree/fsverity-v3

v1:
[4]: https://lore.kernel.org/linux-xfs/20221213172935.680971-1-aalbersh@xxxxxxxxxx/

v2:
[5]: https://lore.kernel.org/linux-xfs/20230404145319.2057051-1-aalbersh@xxxxxxxxxx/

fs-verity:
[6]: https://www.kernel.org/doc/html/latest/filesystems/fsverity.html

Thanks,
Andrey

Allison Henderson (4):
  xfs: Add new name to attri/d
  xfs: add parent pointer support to attribute code
  xfs: define parent pointer xattr format
  xfs: Add xfs_verify_pptr

Andrey Albershteyn (24):
  fs: add FS_XFLAG_VERITY for fs-verity sealed inodes
  fsverity: add drop_page() callout
  fsverity: always use bitmap to track verified status
  fsverity: pass Merkle tree block size to ->read_merkle_tree_page()
  fsverity: pass log_blocksize to end_enable_verity()
  fsverity: operate with Merkle tree blocks instead of pages
  iomap: pass readpage operation to read path
  iomap: allow filesystem to implement read path verification
  xfs: add XBF_VERITY_CHECKED xfs_buf flag
  xfs: add XFS_DA_OP_BUFFER to make xfs_attr_get() return buffer
  xfs: introduce workqueue for post read IO work
  xfs: add bio_set and submit_io for ioend post-processing
  xfs: add attribute type for fs-verity
  xfs: make xfs_buf_get() to take XBF_* flags
  xfs: add XBF_DOUBLE_ALLOC to increase size of the buffer
  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: don't allow to enable DAX on fs-verity sealsed inode
  xfs: disable direct read path for fs-verity sealed files
  xfs: add fs-verity support
  xfs: make scrub aware of verity dinode flag
  xfs: add fs-verity ioctls
  xfs: enable ro-compat fs-verity flag

 Documentation/filesystems/fsverity.rst |   9 +
 fs/btrfs/verity.c                      |   7 +-
 fs/erofs/data.c                        |   4 +-
 fs/ext4/verity.c                       |   6 +-
 fs/f2fs/verity.c                       |   6 +-
 fs/gfs2/aops.c                         |   4 +-
 fs/ioctl.c                             |   4 +
 fs/iomap/buffered-io.c                 |  53 ++++-
 fs/verity/enable.c                     |   6 +-
 fs/verity/fsverity_private.h           |   1 -
 fs/verity/open.c                       |  64 +++---
 fs/verity/read_metadata.c              |  40 ++--
 fs/verity/verify.c                     | 126 +++---------
 fs/xfs/Makefile                        |   1 +
 fs/xfs/libxfs/xfs_attr.c               |  81 +++++++-
 fs/xfs/libxfs/xfs_attr.h               |   7 +-
 fs/xfs/libxfs/xfs_attr_leaf.c          |  24 ++-
 fs/xfs/libxfs/xfs_attr_remote.c        |  40 +++-
 fs/xfs/libxfs/xfs_da_btree.h           |   7 +-
 fs/xfs/libxfs/xfs_da_format.h          |  62 +++++-
 fs/xfs/libxfs/xfs_format.h             |  14 +-
 fs/xfs/libxfs/xfs_log_format.h         |   8 +-
 fs/xfs/libxfs/xfs_sb.c                 |   4 +-
 fs/xfs/scrub/attr.c                    |   4 +-
 fs/xfs/xfs_aops.c                      |  84 +++++++-
 fs/xfs/xfs_aops.h                      |   2 +
 fs/xfs/xfs_attr_item.c                 | 142 +++++++++++---
 fs/xfs/xfs_attr_item.h                 |   1 +
 fs/xfs/xfs_attr_list.c                 |  17 +-
 fs/xfs/xfs_buf.c                       |   7 +-
 fs/xfs/xfs_buf.h                       |  21 +-
 fs/xfs/xfs_file.c                      |  22 ++-
 fs/xfs/xfs_inode.c                     |   2 +
 fs/xfs/xfs_inode.h                     |   3 +-
 fs/xfs/xfs_ioctl.c                     |  22 +++
 fs/xfs/xfs_iomap.c                     |   3 +
 fs/xfs/xfs_iops.c                      |   4 +
 fs/xfs/xfs_linux.h                     |   1 +
 fs/xfs/xfs_mount.h                     |   3 +
 fs/xfs/xfs_ondisk.h                    |   4 +
 fs/xfs/xfs_super.c                     |  28 ++-
 fs/xfs/xfs_trace.h                     |   1 +
 fs/xfs/xfs_verity.c                    | 257 +++++++++++++++++++++++++
 fs/xfs/xfs_verity.h                    |  37 ++++
 fs/xfs/xfs_xattr.c                     |   9 +
 fs/zonefs/file.c                       |   4 +-
 include/linux/fsverity.h               | 129 ++++++++++++-
 include/linux/iomap.h                  |  36 +++-
 include/uapi/linux/fs.h                |   1 +
 49 files changed, 1170 insertions(+), 252 deletions(-)
 create mode 100644 fs/xfs/xfs_verity.c
 create mode 100644 fs/xfs/xfs_verity.h

-- 
2.40.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux