From: Eric Biggers <ebiggers@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Andrey Albershteyn <aalbersh@redhat.com>,
"Darrick J. Wong" <djwong@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
fsverity@lists.linux.dev, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, aalbersh@kernel.org,
david@fromorbit.com, tytso@mit.edu, linux-ext4@vger.kernel.org,
jaegeuk@kernel.org, chao@kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: fsverity metadata offset, was: Re: [PATCH v2 0/23] fs-verity support for XFS with post EOF merkle tree
Date: Mon, 19 Jan 2026 11:32:42 -0800 [thread overview]
Message-ID: <20260119193242.GB13800@sol> (raw)
In-Reply-To: <20260119063349.GA643@lst.de>
On Mon, Jan 19, 2026 at 07:33:49AM +0100, Christoph Hellwig wrote:
> While looking at fsverity I'd like to understand the choise of offset
> in ext4 and f2fs, and wonder about an issue.
>
> Both ext4 and f2fs round up the inode size to the next 64k boundary
> and place the metadata there. Both use the 65536 magic number for that
> instead of a well documented constant unfortunately.
>
> I assume this was picked to align up to the largest reasonable page
> size? Unfortunately for that:
>
> a) not all architectures are reasonable. As Darrick pointed out
> hexagon seems to support page size up to 1MiB. While I don't know
> if they exist in real life, powerpc supports up to 256kiB pages,
> and I know they are used for real in various embedded settings
> b) with large folio support in the page cache, the folios used to
> map files can be much larger than the base page size, with all
> the same issues as a larger page size
>
> So assuming that fsverity is trying to avoid the issue of a page/folio
> that covers both data and fsverity metadata, how does it copy with that?
> Do we need to disable fsverity on > 64k page size and disable large
> folios on fsverity files? The latter would mean writing back all cached
> data first as well.
>
> And going forward, should we have a v2 format that fixes this? For that
> we'd still need a maximum folio size of course. And of course I'd like
> to get all these things right from the start in XFS, while still being as
> similar as possible to ext4/f2fs.
Yes, if I recall correctly it was intended to be the "largest reasonable
page size". It looks like PAGE_SIZE > 65536 can't work as-is, so indeed
we should disable fsverity support in that configuration.
I don't think large folios are quite as problematic.
ext4_read_merkle_tree_page() and f2fs_read_merkle_tree_page() read a
folio and return the appropriate page in it, and fs/verity/verify.c
operates on the page. If it's a page in the folio that spans EOF, I
think everything will actually still work, except userspace will be able
to see Merkle tree data after a 64K boundary past EOF if the file is
mmapped using huge pages.
The mmap issue isn't great, but I'm not sure how much it matters,
especially when the zeroes do still go up to a 64K boundary.
If we do need to fix this, there are a couple things we could consider
doing without changing the on-disk format in ext4 or f2fs: putting the
data in the page cache at a different offset than it exists on-disk, or
using "small" pages for EOF specifically.
But yes, XFS should choose a larger alignment than 64K.
- Eric
next prev parent reply other threads:[~2026-01-19 19:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1768229271.patch-series@thinky>
[not found] ` <aWZ0nJNVTnyuFTmM@casper.infradead.org>
[not found] ` <op5poqkjoachiv2qfwizunoeg7h6w5x2rxdvbs4vhryr3aywbt@cul2yevayijl>
[not found] ` <aWci_1Uu5XndYNkG@casper.infradead.org>
[not found] ` <20260114061536.GG15551@frogsfrogsfrogs>
[not found] ` <5z5r6jizgxqz5axvzwbdmtkadehgdf7semqy2oxsfytmzzu6ik@zfvhexcp3fz2>
[not found] ` <6r24wj3o3gctl3vz4n3tdrfjx5ftkybdjmmye2hejdcdl6qseh@c2yvpd5d4ocf>
2026-01-19 6:33 ` fsverity metadata offset, was: Re: [PATCH v2 0/23] fs-verity support for XFS with post EOF merkle tree Christoph Hellwig
2026-01-19 19:32 ` Eric Biggers [this message]
2026-01-19 19:58 ` Darrick J. Wong
2026-01-20 7:32 ` Christoph Hellwig
2026-01-20 11:44 ` Andrey Albershteyn
2026-01-20 17:34 ` Darrick J. Wong
2026-01-21 15:03 ` Christoph Hellwig
2026-01-19 20:00 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260119193242.GB13800@sol \
--to=ebiggers@kernel.org \
--cc=aalbersh@kernel.org \
--cc=aalbersh@redhat.com \
--cc=chao@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox