fs: add FS_XFLAG_VERITY for fs-verity files

fs-verity introduced inode flag for inodes with enabled fs-verity on
them. This patch adds FS_XFLAG_VERITY file attribute which can be
retrieved with FS_IOC_FSGETXATTR ioctl() and file_getattr() syscall.

This flag is read-only and can not be set with corresponding set ioctl()
and file_setattr(). The FS_IOC_SETFLAGS requires file to be opened for
writing which is not allowed for verity files. The FS_IOC_FSSETXATTR and
file_setattr() clears this flag from the user input.

As this is now common flag for both flag interfaces (flags/xflags) add
it to overlapping flags list to exclude it from overwrite.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Link: https://patch.msgid.link/20260126115658.27656-2-aalbersh@kernel.org
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Andrey Albershteyn
2026-01-26 12:56:57 +01:00
committed by Christian Brauner
parent 40210c2b11
commit 0e6b7eae1f
4 changed files with 24 additions and 3 deletions

View File

@@ -341,6 +341,22 @@ the file has fs-verity enabled. This can perform better than
FS_IOC_GETFLAGS and FS_IOC_MEASURE_VERITY because it doesn't require
opening the file, and opening verity files can be expensive.
FS_IOC_FSGETXATTR
-----------------
Since Linux v7.0, the FS_IOC_FSGETXATTR ioctl sets FS_XFLAG_VERITY (0x00020000)
in the returned flags when the file has verity enabled. Note that this attribute
cannot be set with FS_IOC_FSSETXATTR as enabling verity requires input
parameters. See FS_IOC_ENABLE_VERITY.
file_getattr
------------
Since Linux v7.0, the file_getattr() syscall sets FS_XFLAG_VERITY (0x00020000)
in the returned flags when the file has verity enabled. Note that this attribute
cannot be set with file_setattr() as enabling verity requires input parameters.
See FS_IOC_ENABLE_VERITY.
.. _accessing_verity_files:
Accessing verity files