Linux fsverity development list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrey Albershteyn" <aalbersh@kernel.org>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Carlos Maiolino" <cem@kernel.org>,
	fsverity <fsverity@lists.linux.dev>
Cc: david@fromorbit.com, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH v19 01/15] xfs: introduce fsverity on-disk changes
Date: Fri, 20 Nov 2026 16:26:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-225564@kernel.org> (raw)
In-Reply-To: <20261120155752.192025-2-aalbersh@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] xfs: missing FS_VERITY_FL in xfs_fileattr_set() breaks
  FS_IOC_SETFLAGS
--

commit 6ecc983ef533264f23250c3f4f069d8b6005a644
Author: Andrey Albershteyn <aalbersh@kernel.org>

xfs: introduce fsverity on-disk changes

This commit introduces on-disk format definitions for fs-verity in XFS,
including XFS_SB_FEAT_RO_COMPAT_VERITY and XFS_DIFLAG2_VERITY, along with
inode verifier checks and flag conversions.

> diff --git a/fs/xfs/libxfs/xfs_inode_util.c b/fs/xfs/libxfs/xfs_inode_util.c
> index f486b23a9b523..a717b19558afa 100644
> --- a/fs/xfs/libxfs/xfs_inode_util.c
> +++ b/fs/xfs/libxfs/xfs_inode_util.c
> @@ -73,7 +73,8 @@ xfs_flags2diflags2(
>  	uint64_t		di_flags2 =
>  		(ip->i_diflags2 & (XFS_DIFLAG2_REFLINK |
>  				   XFS_DIFLAG2_BIGTIME |
> -				   XFS_DIFLAG2_NREXT64));
> +				   XFS_DIFLAG2_NREXT64 |
> +				   XFS_DIFLAG2_VERITY));
>  
>  	if (xflags & FS_XFLAG_DAX)
>  		di_flags2 |= XFS_DIFLAG2_DAX;
> @@ -125,6 +126,8 @@ xfs_ip2xflags(
>  			flags |= FS_XFLAG_DAX;
>  		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
>  			flags |= FS_XFLAG_COWEXTSIZE;
> +		if (ip->i_diflags2 & XFS_DIFLAG2_VERITY)
> +			flags |= FS_XFLAG_VERITY;
>  	}

[Severity: Medium]
Does exposing FS_XFLAG_VERITY in xfs_ip2xflags() without allowing
FS_VERITY_FL in xfs_fileattr_set() break FS_IOC_SETFLAGS on verity inodes?

When FS_IOC_GETFLAGS runs on a verity inode, xfs_fileattr_get() ->
xfs_fill_fsxattr() -> fileattr_fill_xflags() translates FS_XFLAG_VERITY
into FS_VERITY_FL in fa->flags.  When userspace such as chattr(1) modifies
an unrelated flag (like FS_NOATIME_FL or FS_IMMUTABLE_FL) and writes the
flags back via FS_IOC_SETFLAGS, xfs_fileattr_set() checks fa->flags against
an allowlist that does not include FS_VERITY_FL:

fs/xfs/xfs_ioctl.c:xfs_fileattr_set() {
    ...
	if (!fa->fsx_valid) {
		unsigned int allowed = FS_IMMUTABLE_FL | FS_APPEND_FL |
				       FS_NOATIME_FL | FS_NODUMP_FL |
				       FS_SYNC_FL | FS_DAX_FL |
				       FS_PROJINHERIT_FL;

		if (xfs_has_asciici(mp))
			allowed |= FS_CASEFOLD_FL;

		if (fa->flags & ~allowed)
			return -EOPNOTSUPP;
	}
    ...
}

Because FS_VERITY_FL is still present in fa->flags from the GETFLAGS read,
FS_IOC_SETFLAGS fails with -EOPNOTSUPP.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120155752.192025-1-aalbersh@kernel.org?part=1

  reply	other threads:[~2026-11-20 16:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:57 [PATCH v19 00/15] fs-verity support for XFS with post EOF merkle tree Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 01/15] xfs: introduce fsverity on-disk changes Andrey Albershteyn
2026-11-20 16:26   ` sashiko-bot [this message]
2026-11-20 15:57 ` [PATCH v19 02/15] xfs: don't allow to enable DAX on fs-verity sealed inode Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 03/15] xfs: disable direct read path for fs-verity files Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 04/15] xfs: don't report dio_mem_align and dio_offset_align for fsverity files Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 05/15] xfs: handle fsverity I/O in write/read path Andrey Albershteyn
2026-11-20 16:27   ` sashiko-bot
2026-11-20 15:57 ` [PATCH v19 06/15] xfs: use read ioend for fsverity data verification Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 07/15] xfs: add XFS_BMAPI_UNWRITTEN to unmap unwritten extents in __xfs_bunmapi() Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 08/15] xfs: don't remove written extents past EOF on fsverity inodes Andrey Albershteyn
2026-11-20 16:21   ` sashiko-bot
2026-11-20 15:57 ` [PATCH v19 09/15] xfs: add fs-verity support Andrey Albershteyn
2026-11-20 16:51   ` sashiko-bot
2026-11-20 15:57 ` [PATCH v19 10/15] xfs: initialize fs-verity on file open Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 11/15] xfs: add fs-verity ioctls Andrey Albershteyn
2026-11-20 16:19   ` sashiko-bot
2026-11-20 15:57 ` [PATCH v19 12/15] xfs: advertise fs-verity being available on filesystem Andrey Albershteyn
2026-11-20 15:57 ` [PATCH v19 13/15] xfs: check and repair the verity inode flag state Andrey Albershteyn
2026-11-20 16:28   ` sashiko-bot
2026-11-20 15:57 ` [PATCH v19 14/15] xfs: introduce health state for corrupted fsverity metadata Andrey Albershteyn
2026-11-20 16:36   ` sashiko-bot
2026-11-20 15:57 ` [PATCH v19 15/15] xfs: enable ro-compat fs-verity flag Andrey Albershteyn
2026-11-20 16:38   ` sashiko-bot

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=sashiko-outbox-225564@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=sashiko-reviews@lists.linux.dev \
    /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