All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: fsverity@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
	Chao Yu <chao@kernel.org>
Subject: Re: [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
Date: Sat, 14 Feb 2026 12:48:33 -0800	[thread overview]
Message-ID: <20260214204833.GA10472@quark> (raw)
In-Reply-To: <CAHk-=wi60UWZ=kVayGKfrGURiX4aN6P4J_bNMOw_pSvUrxw1jw@mail.gmail.com>

On Sat, Feb 14, 2026 at 12:39:22PM -0800, Linus Torvalds wrote:
> On Sat, 14 Feb 2026 at 12:33, Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > -               if (fsverity_verify_page(dic->vi, rpage))
> > +               if (fsverity_verify_blocks(dic->vi, page_folio(rpage),
> > +                                          PAGE_SIZE, 0))
> 
> This really is very wrong. It may be equivalent to the old code, but
> the old code was *also* wrong.
> 
> If you use "page_folio()", you need to do the proper offsetting of the
> page inside the folio, unless the filesystem is purely using the old
> legacy "folio is the same as page", which is simply not true in f2fs.
> 
> It might be true in this particular case, but considering that it was
> *NOT* true in another case I fixed up, I really don't want to see this
> same mistake done over and over again.
> 
> So either it's the whole folio, in which case PAGE_SIZE is wrong.
> 
> Or it really is PAGE_SIZE, in which case you need to use the proper
> offset within the folio.
> 
> Don't take the old buggy garbage that was fsverity_verify_page() and
> repeat the bug when you remove it.

The reason I went with the direct conversion is that
f2fs_verify_cluster() clearly assumes small folios already, and indeed
it's called only with small folios.  But sure, we can make that specific
line in it large-folio-aware.

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
Date: Sat, 14 Feb 2026 12:48:33 -0800	[thread overview]
Message-ID: <20260214204833.GA10472@quark> (raw)
In-Reply-To: <CAHk-=wi60UWZ=kVayGKfrGURiX4aN6P4J_bNMOw_pSvUrxw1jw@mail.gmail.com>

On Sat, Feb 14, 2026 at 12:39:22PM -0800, Linus Torvalds wrote:
> On Sat, 14 Feb 2026 at 12:33, Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > -               if (fsverity_verify_page(dic->vi, rpage))
> > +               if (fsverity_verify_blocks(dic->vi, page_folio(rpage),
> > +                                          PAGE_SIZE, 0))
> 
> This really is very wrong. It may be equivalent to the old code, but
> the old code was *also* wrong.
> 
> If you use "page_folio()", you need to do the proper offsetting of the
> page inside the folio, unless the filesystem is purely using the old
> legacy "folio is the same as page", which is simply not true in f2fs.
> 
> It might be true in this particular case, but considering that it was
> *NOT* true in another case I fixed up, I really don't want to see this
> same mistake done over and over again.
> 
> So either it's the whole folio, in which case PAGE_SIZE is wrong.
> 
> Or it really is PAGE_SIZE, in which case you need to use the proper
> offset within the folio.
> 
> Don't take the old buggy garbage that was fsverity_verify_page() and
> repeat the bug when you remove it.

The reason I went with the direct conversion is that
f2fs_verify_cluster() clearly assumes small folios already, and indeed
it's called only with small folios.  But sure, we can make that specific
line in it large-folio-aware.

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2026-02-14 20:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-14 20:33 [PATCH 0/2] fsverity: remove fsverity_verify_page() Eric Biggers
2026-02-14 20:33 ` [f2fs-dev] " Eric Biggers via Linux-f2fs-devel
2026-02-14 20:33 ` [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page() Eric Biggers
2026-02-14 20:33   ` [f2fs-dev] " Eric Biggers via Linux-f2fs-devel
2026-02-14 20:39   ` Linus Torvalds
2026-02-14 20:39     ` [f2fs-dev] " Linus Torvalds
2026-02-14 20:48     ` Eric Biggers [this message]
2026-02-14 20:48       ` Eric Biggers via Linux-f2fs-devel
2026-02-14 20:55       ` Linus Torvalds
2026-02-14 20:55         ` [f2fs-dev] " Linus Torvalds
2026-02-14 20:33 ` [PATCH 2/2] fsverity: remove fsverity_verify_page() Eric Biggers
2026-02-14 20:33   ` [f2fs-dev] " Eric Biggers via Linux-f2fs-devel

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=20260214204833.GA10472@quark \
    --to=ebiggers@kernel.org \
    --cc=chao@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.