From: Andrey Albershteyn <aalbersh@kernel.org>
To: ebiggers@kernel.org, hch@lst.de, fsverity@lists.linux.dev,
dsterba@suse.com
Cc: Andrey Albershteyn <aalbersh@kernel.org>,
linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
brauner@kernel.org, viro@zeniv.linux.org.uk, jaegeuk@kernel.org,
chao@kernel.org, tytso@mit.edu, Boris Burkov <boris@bur.io>
Subject: [PATCH v2 1/5] fsverity: strip FS_VERITY_FL from FS_IOC_SETFLAGS
Date: Thu, 5 Nov 2026 12:55:26 +0100 [thread overview]
Message-ID: <20261105115532.613467-2-aalbersh@kernel.org> (raw)
In-Reply-To: <20261105115532.613467-1-aalbersh@kernel.org>
The common use of FS_IOC_GETFLAGS/SETFLAGS is get-modify-set loop.
Filesystems could return verity status with GETFLAGS, attempting to then
pass FS_VERITY_FL to SETFLAGS is not allowed.
The ext4 and f2fs already treat FS_VERITY_FL in the set path as no-op,
however, BTRFS returns -EOPNOTSUPP. So, the modification of other flags
doesn't work on BTRFS for fsverity inodes.
Fix it for BTRFS and anyone else, the ext4 and f2fs masking becomes
no-op. The file_get/setattr() path is fine here as this flag is cleared
right before fileattr_set_prepare(). The future fsverity support in XFS
would also need it.
Cc: Boris Burkov <boris@bur.io>
Cc: David Sterba <dsterba@suse.com>
Fixes: 146054090b08 ("btrfs: initial fsverity support")
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
---
fs/file_attr.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/file_attr.c b/fs/file_attr.c
index 833e03810b24..b43977d5f8e0 100644
--- a/fs/file_attr.c
+++ b/fs/file_attr.c
@@ -199,6 +199,16 @@ static int fileattr_set_prepare(struct inode *inode,
if (err)
return err;
+ /*
+ * verity is settable only via FS_IOC_ENABLE_VERITY; never through
+ * fileattr
+ *
+ * Treat it as a no-op so the FS_IOC_GETFLAGS/SETFLAGS round-trip
+ * doesn't break for other flags
+ */
+ fa->flags &= ~FS_VERITY_FL;
+ fa->fsx_xflags &= ~FS_XFLAG_VERITY;
+
/*
* Project Quota ID state is only allowed to change from within the init
* namespace. Enforce that restriction only if we are trying to change
--
2.54.0
next prev parent reply other threads:[~2026-11-05 11:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 11:55 [PATCH v2 0/5] fsverity: lift ioctl() input masking and runtime inode flag to VFS Andrey Albershteyn
2026-11-05 11:55 ` Andrey Albershteyn [this message]
2026-11-05 12:03 ` [f2fs-dev] [PATCH v2 1/5] fsverity: strip FS_VERITY_FL from FS_IOC_SETFLAGS sashiko-bot
2026-11-06 10:26 ` Christoph Hellwig
2026-11-05 11:55 ` [PATCH v2 2/5] fsverity: add I_VERITY_BUILDING inode state flag Andrey Albershteyn
2026-11-05 12:03 ` [f2fs-dev] " sashiko-bot
2026-11-06 10:26 ` Christoph Hellwig
2026-11-05 11:55 ` [PATCH v2 3/5] btrfs: use I_VERITY_BUILDING instead of private flags Andrey Albershteyn
2026-11-05 12:03 ` sashiko-bot
2026-11-06 10:26 ` Christoph Hellwig
2026-11-05 11:55 ` [PATCH v2 4/5] ext4: " Andrey Albershteyn
2026-11-05 12:01 ` [f2fs-dev] " sashiko-bot
2026-11-06 10:27 ` Christoph Hellwig
2026-11-05 11:55 ` [PATCH v2 5/5] f2fs: " Andrey Albershteyn
2026-11-05 12:03 ` [f2fs-dev] " sashiko-bot
2026-11-06 10:27 ` Christoph Hellwig
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=20261105115532.613467-2-aalbersh@kernel.org \
--to=aalbersh@kernel.org \
--cc=boris@bur.io \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=dsterba@suse.com \
--cc=ebiggers@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=hch@lst.de \
--cc=jaegeuk@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).