fs-verity support for XFS
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest7 of 23 patches 0 repliesNew
7 of 23 patches are in this archive. The cover letter announces 23.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 6/23 | fsverity: add drop_page() callout | +0 | 1 reply | |
| 16/23 | xfs: add inode on-disk VERITY flag | +0 | 1 reply | |
| 19/23 | xfs: disable direct read path for fs-verity sealed files | +0 | 0 replies | |
| 19/23 | xfs: disable direct read path for fs-verity sealed files | +0 | 0 replies | |
| 21/23 | xfs: handle merkle tree block size != fs blocksize != PAGE_SIZE | +0 | 1 reply | |
| 21/23 | xfs: handle merkle tree block size != fs blocksize != PAGE_SIZE | +0 | 0 replies | |
| 21/23 | xfs: handle merkle tree block size != fs blocksize != PAGE_SIZE | +0 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [Cluster-devel] [PATCH v2 00/23] fs-verity support for XFS
Quoted 13 lines · Eric Biggers
Quoted 11 lines · Christoph Hellwig
Dave is going to hate me for this, but..
I've been looking over some of the interfaces here, and I'm starting to very seriously questioning the design decisions of storing the fsverity hashes in xattrs.
Yes, storing them beyond
i_sizein the file is a bit of a hack, but it allows to reuse a lot of the existing infrastructure, and much of fsverity is based around it. So storing them in an xattrs causes a lot of churn in the interface. And the XFS side with special casing xattr indices also seems not exactly nice.
Quoted 8 lines
It seems it's really just the Merkle tree caching interface that is causing problems, as it's currently too closely tied to the page cache? That is just an implementation detail that could be reworked along the lines of what is being discussed.
But anyway, it is up to the XFS folks. Keep in mind there is also the option of doing what btrfs is doing, where it stores the Merkle tree separately from the file data stream, but caches it past
i_sizein the page cache at runtime.
Right. It's not entirely simple to store metadata on disk beyond EOF in XFS because of all the assumptions throughout the IO path and allocator interfaces that it can allocate space beyond EOF at will and something else will clean it up later if it is not needed. This impacts on truncate, delayed allocation, writeback, IO completion, EOF block removal on file close, background garbage collection, ENOSPC/EDQUOT driven space freeing, etc. Some of these things cross over into iomap infrastructure, too.
AFAIC, it's far more intricate, complex and risky to try to store merkle tree data beyond EOF than it is to put it in an xattr namespace because IO path EOF handling bugs result in user data corruption. This happens over and over again, no matter how careful we are about these aspects of user data handling.
OTOH, putting the merkle tree data in a different namespace avoids these issues completely. Yes, we now have to solve an API mismatch, but we aren't risking the addition of IO path data corruption bugs to every non-fsverity filesystem in production...
Hence I think copying the btrfs approach (i.e. only caching the merkle tree data in the page cache beyond EOF) would be as far as I think we'd want to go. Realistically, there would be little practical difference between btrfs storing the merkle tree blocks in a separate internal btree and XFS storing them in an internal private xattr btree namespace.
I would, however, prefer not to have to do this at all if we could simply map the blocks directly out of the xattr buffers as we already do internally for all the XFS code...
Quoted 7 lines
I guess there is also the issue of encryption, which hasn't come up yet since we're talking about fsverity support only. The Merkle tree (including the
fsverity_descriptor) is supposed to be encrypted, just like the file contents are. Having it be stored after the file contents accomplishes that easily... Of course, it doesn't have to be that way; a separate key could be derived, or the Merkle tree blocks could be encrypted with the file contents key using indices pasti_size, without them physically being stored in the data stream.
I'm expecting that fscrypt for XFS will include encryption of the xattr names and values (just like we will need to do for directory names) except for the xattrs that hold the encryption keys themselves. That means the merkle tree blocks should get encrypted without any extra work needing to be done anywhere. This will simply require the fscrypt keys to be held in a private internal xattr namespace that isn't encrypted, but that's realtively trivial to do...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner david at fromorbit.com