From: Eric Biggers <ebiggers@kernel.org>
To: Boris Burkov <boris@bur.io>
Cc: fstests@vger.kernel.org, linux-fscrypt@vger.kernel.org,
linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v8 2/5] common/verity: support btrfs in generic fsverity tests
Date: Fri, 22 Apr 2022 17:59:51 -0700 [thread overview]
Message-ID: <YmNPhzTpoE9jIU4D@sol.localdomain> (raw)
In-Reply-To: <YmM54bCgX6Kz2XVX@zen>
On Fri, Apr 22, 2022 at 04:27:29PM -0700, Boris Burkov wrote:
> On Thu, Mar 17, 2022 at 06:16:45PM +0000, Eric Biggers wrote:
> > On Wed, Mar 16, 2022 at 01:25:12PM -0700, Boris Burkov wrote:
> > > generic/572-579 have tests for fsverity. Now that btrfs supports
> > > fsverity, make these tests function as well. For a majority of the tests
> > > that pass, simply adding the case to mkfs a btrfs filesystem with no
> > > extra options is sufficient.
> > >
> > > However, generic/574 has tests for corrupting the merkle tree itself.
> > > Since btrfs uses a different scheme from ext4 and f2fs for storing this
> > > data, the existing logic for corrupting it doesn't work out of the box.
> > > Adapt it to properly corrupt btrfs merkle items.
> > >
> > > 576 does not run because btrfs does not support transparent encryption.
> > >
> > > This test relies on the btrfs implementation of fsverity in the patch:
> > > btrfs: initial fsverity support
> > >
> > > and on btrfs-corrupt-block for corruption in the patches titled:
> > > btrfs-progs: corrupt generic item data with btrfs-corrupt-block
> > > btrfs-progs: expand corrupt_file_extent in btrfs-corrupt-block
> > >
> > > Signed-off-by: Boris Burkov <boris@bur.io>
> > > ---
> > > common/btrfs | 5 +++++
> > > common/config | 1 +
> > > common/verity | 23 +++++++++++++++++++++++
> > > 3 files changed, 29 insertions(+)
> >
> > Reviewed-by: Eric Biggers <ebiggers@google.com>
> >
> > - Eric
>
> Eric,
>
> Unfortunately, I think I found a more serious problem with the
> compatibility of generic/574 and btrfs while working on testing the
> enable/disable sysctls.
>
> I realized that I had forgotten to customize the mount options for btrfs
> to use "nodatasum" and as a result, this test was passing for btrfs
> inappropriately, since we were getting EIOs for failing data checksums,
> not verity checks.
>
> I fixed the mount option issue only to realize that some of the test
> cases make assumptions that don't apply to btrfs. For example:
> "corruption_test 130999 131000 72"
>
> Btrfs zeros pages past EOF in readpage before they make it to the user
> via read or mmap, and the fsverity check is done at that point, so
> corrupting the disk past EOF does not cause a verity failure (or get
> leaked to the user) but it does cause csum failures since those are done
> on bios, like verity checks in ext4. I verified that removing that
> zeroing in readpage makes the test case pass.
>
> Do you have a preference for how I might fix this? My first thought is
> to try to factor out any such test cases into a new test with a new
> requires clause that btrfs fails but ext4/f2fs pass, kind of like what
> we did for the EFBIG test for future FSes that might not logically
> address the Merkle tree in the past-EOF space.
The reason that an error is expected for corruption past EOF in the block
containing EOF, is to ensure that the bad data isn't visible via mmap reads. If
that's not a problem for btrfs due to it always zeroing the part past EOF, I
think it would be fine to change that test case (specifically the one with
parameters "corruption_test 130999 131000 72") to just try a mmap read of the
whole EOF block, and check that it either fails with an error *or* returns
zeroes. I don't think that an entirely new test script would be warranted.
- Eric
next prev parent reply other threads:[~2022-04-23 1:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 20:25 [PATCH v8 0/5] tests for btrfs fsverity Boris Burkov
2022-03-16 20:25 ` [PATCH v8 1/5] common/verity: require corruption functionality Boris Burkov
2022-03-17 18:16 ` Eric Biggers
2022-03-16 20:25 ` [PATCH v8 2/5] common/verity: support btrfs in generic fsverity tests Boris Burkov
2022-03-17 18:16 ` Eric Biggers
2022-04-22 23:27 ` Boris Burkov
2022-04-23 0:59 ` Eric Biggers [this message]
2022-03-16 20:25 ` [PATCH v8 3/5] btrfs: test btrfs specific fsverity corruption Boris Burkov
2022-04-10 14:53 ` Eryu Guan
2022-04-11 14:10 ` David Sterba
2022-04-11 21:22 ` Boris Burkov
2022-03-16 20:25 ` [PATCH v8 4/5] btrfs: test verity orphans with dmlogwrites Boris Burkov
2022-03-16 20:25 ` [PATCH v8 5/5] generic: test fs-verity EFBIG scenarios Boris Burkov
2022-03-17 18:17 ` Eric Biggers
2022-03-17 18:19 ` [PATCH v8 0/5] tests for btrfs fsverity Eric Biggers
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=YmNPhzTpoE9jIU4D@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=boris@bur.io \
--cc=fstests@vger.kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fscrypt@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