public inbox for fsverity@lists.linux.dev
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Alexander Larsson <alexl@redhat.com>
Cc: Amir Goldstein <amir73il@gmail.com>,
	miklos@szeredi.hu, linux-unionfs@vger.kernel.org, tytso@mit.edu,
	fsverity@lists.linux.dev
Subject: Re: [PATCH v3 2/4] ovl: Add framework for verity support
Date: Sat, 17 Jun 2023 12:47:35 -0700	[thread overview]
Message-ID: <20230617194735.GA4703@sol.localdomain> (raw)
In-Reply-To: <CAL7ro1G+Dnet=M+CUY7e_9nJhOtD3rQm16C7bWkMBVnfcvm4Yg@mail.gmail.com>

On Fri, Jun 16, 2023 at 10:11:06AM +0200, Alexander Larsson wrote:
> On Fri, Jun 16, 2023 at 1:52 AM Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > On Wed, Jun 14, 2023 at 09:57:41AM +0200, Alexander Larsson wrote:
> > > When a layer containing verity xattrs is used, it means that any
> > > such metacopy file in the upper layer is guaranteed to match the
> > > content that was in the lower at the time of the copy-up. If at any time
> > > (during a mount, after a remount, etc) such a file in the lower is
> > > replaced or modified in any way, then opening the corresponding file on
> > > overlayfs will result in EIO and a detailed error printed to the kernel logs.
> > > (Actually, due to caching the overlayfs mount might still see the previous
> > > file contents after a lower file is replaced under an active mount, but
> > > it will never see the wrong data.)
> >
> > Well, the key point of fsverity is that data is not verified until it is
> > actually read.  At open time, the fsverity file digest is made available in
> > constant time, and overlayfs will verify that.  However, invalid data blocks are
> > not reported until the data is actually read.  The error that applications get
> > is EIO for syscalls, and SIGBUS for memory-mapped reads, as mentioned at
> > https://www.kernel.org/doc/html/latest/filesystems/fsverity.html#accessing-verity-files
> >
> > So overlayfs might report EIO at open time, or it might not report an error
> > until the modified data is read.  And in the latter case, presumably the error
> > seen by the application matches the one for using fsverity natively?
> 
> Yes, I'm aware of that, but do we need to describe this in the
> overlayfs documentation?
> The text I wrote is describing the behaviour that overlayfs adds to
> the mix, and I sort of
> assumed the late validation from fs-verity itself would be known about
> if the file already
> has fs-verity enabled.
> 
> > You can link to the fsverity documentation somewhere if it would be helpful, but
> > I'd still like the semantics of how this works on overlayfs to be documented.
> 
> I guess just adding a link to that is not that bad. What about:
> 
> ----
> When a layer containing verity xattrs is used, it means that any such
> metacopy file in the upper layer is guaranteed to match the content
> that was in the lower at the time of the copy-up. If at any time
> (during a mount, after a remount, etc) such a file in the lower is
> replaced or modified in any way, then opening the corresponding file
> on overlayfs will result in EIO and a detailed error printed to the
> kernel logs.  (Actually, due to caching the overlayfs mount might
> still see the previous file contents after a lower file is replaced
> under an active mount, but it will never see the wrong data.)  In
> addition fs-verity will do late validation of the file content, as
> described in :ref:`Documentation/filesystems/fsverity.rst
> <accessing_verity_files>`.

That still has the incorrect statement "If at any time (during a mount, after a
remount, etc) such a file in the lower is replaced or modified in any way, then
opening the corresponding file on overlayfs will result in EIO and a detailed
error printed to the kernel logs."  See my last email where I explained why that
statement is not correct.

- Eric

  reply	other threads:[~2023-06-17 19:47 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 10:27 [PATCH v3 0/4] ovl: Add support for fs-verity checking of lowerdata Alexander Larsson
2023-06-12 10:27 ` [PATCH v3 1/4] fsverity: Export fsverity_get_digest Alexander Larsson
2023-06-12 10:27 ` [PATCH v3 2/4] ovl: Add framework for verity support Alexander Larsson
2023-06-12 16:32   ` Eric Biggers
2023-06-13  5:18     ` Amir Goldstein
2023-06-13  6:37       ` Eric Biggers
2023-06-13  8:08         ` Alexander Larsson
2023-06-13  9:34         ` Amir Goldstein
2023-06-13 18:22           ` Eric Biggers
2023-06-14  5:24             ` Amir Goldstein
2023-06-14  7:57               ` Alexander Larsson
2023-06-15 23:52                 ` Eric Biggers
2023-06-16  8:11                   ` Alexander Larsson
2023-06-17 19:47                     ` Eric Biggers [this message]
2023-06-19  7:58                       ` Alexander Larsson
2023-06-12 10:27 ` [PATCH v3 3/4] ovl: Validate verity xattr when resolving lowerdata Alexander Larsson
2023-06-12 10:28   ` Alexander Larsson
2023-06-12 19:09   ` Eric Biggers
2023-06-13 11:41     ` Alexander Larsson
2023-06-13 17:57       ` Eric Biggers
2023-06-14  3:28         ` Eric Biggers
2023-06-14  5:39           ` Amir Goldstein
2023-06-14  7:19           ` Alexander Larsson
2023-06-12 10:28 ` [PATCH v3 4/4] ovl: Handle verity during copy-up Alexander Larsson
2023-06-12 10:52   ` Amir Goldstein
2023-06-12 10:54 ` [PATCH v3 0/4] ovl: Add support for fs-verity checking of lowerdata Amir Goldstein
2023-06-12 11:09   ` Alexander Larsson
2023-06-12 14:53     ` Alexander Larsson
2023-06-12 15:05       ` Amir Goldstein
2023-06-14  6:14       ` Amir Goldstein
2023-06-14  7:07         ` Eric Biggers
2023-06-14  7:16         ` Alexander Larsson
2023-06-22  9:36           ` Amir Goldstein
2023-06-22  9:51             ` Alexander Larsson
2023-06-22 11:45               ` Amir Goldstein
2023-06-26 13:01                 ` Amir Goldstein
2023-07-03  8:11                   ` Alexander Larsson
2023-07-06  7:10                     ` Amir Goldstein
2023-07-06  7:50                       ` Alexander Larsson
2023-06-22 16:12             ` Eric Biggers
2023-06-22 18:07               ` Amir Goldstein
2023-06-13 13:57 ` Alexander Larsson
2023-06-13 17:59   ` Eric Biggers
2023-06-14  7:15     ` Alexander Larsson

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=20230617194735.GA4703@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=alexl@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=fsverity@lists.linux.dev \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    /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