public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fsverity: remove fsverity_verify_page()
@ 2026-02-14 20:33 Eric Biggers
  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 ` [PATCH 2/2] fsverity: remove fsverity_verify_page() Eric Biggers
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Biggers @ 2026-02-14 20:33 UTC (permalink / raw)
  To: fsverity
  Cc: linux-f2fs-devel, linux-fsdevel, Linus Torvalds, Jaegeuk Kim,
	Chao Yu, Eric Biggers

This series removes the non-large-folio-aware function
fsverity_verify_page(), which is no longer needed.

Eric Biggers (2):
  f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
  fsverity: remove fsverity_verify_page()

 fs/f2fs/compress.c       | 3 ++-
 fs/verity/verify.c       | 4 ++--
 include/linux/fsverity.h | 6 ------
 3 files changed, 4 insertions(+), 9 deletions(-)


base-commit: 3e48a11675c50698374d4ac596fb506736eb1c53
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
  2026-02-14 20:33 [PATCH 0/2] fsverity: remove fsverity_verify_page() Eric Biggers
@ 2026-02-14 20:33 ` Eric Biggers
  2026-02-14 20:39   ` Linus Torvalds
  2026-02-14 20:33 ` [PATCH 2/2] fsverity: remove fsverity_verify_page() Eric Biggers
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Biggers @ 2026-02-14 20:33 UTC (permalink / raw)
  To: fsverity
  Cc: linux-f2fs-devel, linux-fsdevel, Linus Torvalds, Jaegeuk Kim,
	Chao Yu, Eric Biggers

Replace the only remaining caller of fsverity_verify_page() with the
equivalent direct call to fsverity_verify_blocks().  No functional
change.  This will allow fsverity_verify_page() to be removed.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 fs/f2fs/compress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 006a80acd1de..6d688835387d 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1815,11 +1815,12 @@ static void f2fs_verify_cluster(struct work_struct *work)
 		struct page *rpage = dic->rpages[i];
 
 		if (!rpage)
 			continue;
 
-		if (fsverity_verify_page(dic->vi, rpage))
+		if (fsverity_verify_blocks(dic->vi, page_folio(rpage),
+					   PAGE_SIZE, 0))
 			SetPageUptodate(rpage);
 		else
 			ClearPageUptodate(rpage);
 		unlock_page(rpage);
 	}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] fsverity: remove fsverity_verify_page()
  2026-02-14 20:33 [PATCH 0/2] fsverity: remove fsverity_verify_page() Eric Biggers
  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 ` Eric Biggers
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2026-02-14 20:33 UTC (permalink / raw)
  To: fsverity
  Cc: linux-f2fs-devel, linux-fsdevel, Linus Torvalds, Jaegeuk Kim,
	Chao Yu, Eric Biggers

Now that fsverity_verify_page() has no callers, remove it.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 fs/verity/verify.c       | 4 ++--
 include/linux/fsverity.h | 6 ------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index 31797f9b24d0..3e38749fbc82 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -431,12 +431,12 @@ EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
  * verification, then bio->bi_status is set to an error status.
  *
  * This is a helper function for use by the ->readahead() method of filesystems
  * that issue bios to read data directly into the page cache.  Filesystems that
  * populate the page cache without issuing bios (e.g. non block-based
- * filesystems) must instead call fsverity_verify_page() directly on each page.
- * All filesystems must also call fsverity_verify_page() on holes.
+ * filesystems) must instead call fsverity_verify_blocks() directly.  All
+ * filesystems must also call fsverity_verify_blocks() on holes.
  */
 void fsverity_verify_bio(struct fsverity_info *vi, struct bio *bio)
 {
 	struct fsverity_verification_context ctx;
 	struct folio_iter fi;
diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h
index fed91023bea9..6de3ddf0b148 100644
--- a/include/linux/fsverity.h
+++ b/include/linux/fsverity.h
@@ -280,16 +280,10 @@ static inline bool fsverity_verify_folio(struct fsverity_info *vi,
 					 struct folio *folio)
 {
 	return fsverity_verify_blocks(vi, folio, folio_size(folio), 0);
 }
 
-static inline bool fsverity_verify_page(struct fsverity_info *vi,
-					struct page *page)
-{
-	return fsverity_verify_blocks(vi, page_folio(page), PAGE_SIZE, 0);
-}
-
 /**
  * fsverity_file_open() - prepare to open a verity file
  * @inode: the inode being opened
  * @filp: the struct file being set up
  *
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
  2026-02-14 20:33 ` [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page() Eric Biggers
@ 2026-02-14 20:39   ` Linus Torvalds
  2026-02-14 20:48     ` Eric Biggers
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2026-02-14 20:39 UTC (permalink / raw)
  To: Eric Biggers
  Cc: fsverity, linux-f2fs-devel, linux-fsdevel, Jaegeuk Kim, Chao Yu

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.

                Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
  2026-02-14 20:39   ` Linus Torvalds
@ 2026-02-14 20:48     ` Eric Biggers
  2026-02-14 20:55       ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Biggers @ 2026-02-14 20:48 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: fsverity, linux-f2fs-devel, linux-fsdevel, Jaegeuk Kim, Chao Yu

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page()
  2026-02-14 20:48     ` Eric Biggers
@ 2026-02-14 20:55       ` Linus Torvalds
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2026-02-14 20:55 UTC (permalink / raw)
  To: Eric Biggers
  Cc: fsverity, linux-f2fs-devel, linux-fsdevel, Jaegeuk Kim, Chao Yu

On Sat, 14 Feb 2026 at 12:48, Eric Biggers <ebiggers@kernel.org> wrote:
>
> The reason I went with the direct conversion is that
> f2fs_verify_cluster() clearly assumes small folios already

... and that was exactly the same thinking that led to the other bug -
"it's fine when folios and pages are the same".

And then when the caller was then changed to know about large folios,
the code silently became buggy even when it visually *looked* right,
because the page-to-folio translation had cut corners.

           Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-14 20:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-14 20:33 [PATCH 0/2] fsverity: remove fsverity_verify_page() Eric Biggers
2026-02-14 20:33 ` [PATCH 1/2] f2fs: use fsverity_verify_blocks() instead of fsverity_verify_page() Eric Biggers
2026-02-14 20:39   ` Linus Torvalds
2026-02-14 20:48     ` Eric Biggers
2026-02-14 20:55       ` Linus Torvalds
2026-02-14 20:33 ` [PATCH 2/2] fsverity: remove fsverity_verify_page() Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox