Re: [f2fs-dev] [PATCH 06/11] fsverity: push out fsverity_info lookup

Christoph Hellwig
2026-01-26T04:33:26Z

On Sat, Jan 24, 2026 at 01:19:56PM -0800, Eric Biggers wrote:
> This patch introduces another bisection hazard by adding calls to
> fsverity_info_addr() when CONFIG_FS_VERITY=n. fsverity_info_addr() has
> a definition only when CONFIG_FS_VERITY=y.
>
> Maybe temporarily add a CONFIG_FS_VERITY=n stub for fsverity_info_addr()
> that returns NULL, and also ensure that it's dereferenced only when it's
> known that fsverity verification is needed. Most of the call sites look
> okay, but the second one in ext4_mpage_readpages() needs to be fixed.

I've added an external declaration for fsverity_info_addr in the
CONFIG_FS_VERITY=n so that the linker catches unguarded references. It
caught two, which I fixed by adding IS_ENABLED checks that also reduce
the code size for non-fsverity builds.

> > - fsverity_init_verification_context(&ctx, inode);
> > + fsverity_init_verification_context(&ctx, inode, vi);
>
> Note that fsverity_info has a back-pointer to the inode. So,
> fsverity_init_verification_context() could just take the vi and set
> ctx->inode to vi->inode.
>
> Then it wouldn't be necessary to get the inode from
> bio_first_folio_all(bio)->mapping->host (in fsverity_verify_bio()) or
> folio->mapping->host (in fsverity_verify_blocks()).
> Similarly in fsverity_readahead() too.
>
> (It might make sense to handle this part as a separate patch.)

To be able to nicely used this vi->inode needs to lose the const
qualifier. I've done that, and also added a const qualifiers
to ctx->vi while at it in prep patches. With that just using
vi->inode in this patch is easy enough.