From: Qu Wenruo <wqu@suse.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH v3] fstests: generic: add a test case to check fsverity reads
Date: Fri, 16 Oct 2026 18:35:05 +1030 [thread overview]
Message-ID: <eac493e2-8bd6-4584-bd90-7601a210f802@suse.com> (raw)
In-Reply-To: <20261016074756.GD3049@sol>
在 2026/10/16 18:17, Eric Biggers 写道:
> On Mon, Oct 12, 2026 at 08:56:13AM +1030, Qu Wenruo wrote:
>> +_fixed_by_fs_commit btrfs xxxxxxxxxxxx \
>> + "btrfs: fix the fsverity callback where unexpected range is verified"
>
> Even without that commit, 'kvm-xfstests -c btrfs generic/807' still
> passes. Under what circumstances will this test fail?
It need as least 7.2 upstream, which enables large data folios for btrfs
by default.
And I can always reproduce it here, mind to provide more info about the
passed run?
>
>> +# Read the file, unpatched btrfs will verify blocks outside the read range and
>> +# trigger fs-verity warnings.
>> +# But the read itself should still be fine, as the failed part will be retried.
>> +cat "$SCRATCH_MNT/foobar" > /dev/null
>
> How about using md5sum and putting the expected value in the .out file,
> so the contents are validated too?
That won't catch the problem.
The root problem is that, for a large folio, a read bio can only cover
part of the folio.
And at end io time, unpatched btrfs call fsverity_verify_folio() which
can have data that is still under read, thus fsverity will report errors.
However after each read, the correct data are already copied into the
page cache.
So after a fsverity verification failure, MM/VFS will retry the read,
and since other parts may have already copied the correct data into page
cache, eventually the incorrect fsverity_verify_folio() will succeed,
thus no read error is returned to the user space.
So md5sum will always be correct.
>
>> +# Check for any kernel warnings from fs-verity on file corruption.
>> +if _check_dmesg_for "FILE CORRUPTED!"; then
>> + echo "fs-verity detected corruption"
>> +fi
>
> Is there a way to use the fserror support being added by
> https://lore.kernel.org/fsverity/20261002223705.2175542-2-aalbersh@kernel.org/
> instead of relying on the unstable text printed to the kernel log? If
> the string is changed at all, this test will become ineffective.
That's a better idea, I'll need to check if it's possible grab fserror
info from btrfs.
Thanks,
Qu
>
> - Eric
next prev parent reply other threads:[~2026-10-16 8:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 22:26 [PATCH v3] fstests: generic: add a test case to check fsverity reads Qu Wenruo
2026-10-12 12:33 ` Christoph Hellwig
2026-10-12 16:32 ` Dhruva G
2026-10-16 7:47 ` Eric Biggers
2026-10-16 8:05 ` Qu Wenruo [this message]
2026-10-16 8:24 ` Eric Biggers
2026-10-16 8:54 ` Qu Wenruo
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=eac493e2-8bd6-4584-bd90-7601a210f802@suse.com \
--to=wqu@suse.com \
--cc=ebiggers@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.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