Unverified Commit b1353865 authored by Christian Brauner's avatar Christian Brauner
Browse files

Merge patch series "Add traces and file attributes for fs-verity"

Andrey Albershteyn <aalbersh@kernel.org> says:

This two small patches grew from fs-verity XFS patchset. I think they're
self-contained improvements which could go without XFS implementation.

* patches from https://patch.msgid.link/20260126115658.27656-1-aalbersh@kernel.org:
  fsverity: add tracepoints
  fs: add FS_XFLAG_VERITY for fs-verity files

Link: https://patch.msgid.link/20260126115658.27656-1-aalbersh@kernel.org


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parents 40210c2b fa19d42c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -10311,6 +10311,7 @@ T: git https://git.kernel.org/pub/scm/fs/fsverity/linux.git
F:	Documentation/filesystems/fsverity.rst
F:	fs/verity/
F:	include/linux/fsverity.h
F:	include/trace/events/fsverity.h
F:	include/uapi/linux/fsverity.h
FT260 FTDI USB-HID TO I2C BRIDGE DRIVER
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags)
		fa->flags |= FS_DAX_FL;
	if (fa->fsx_xflags & FS_XFLAG_PROJINHERIT)
		fa->flags |= FS_PROJINHERIT_FL;
	if (fa->fsx_xflags & FS_XFLAG_VERITY)
		fa->flags |= FS_VERITY_FL;
}
EXPORT_SYMBOL(fileattr_fill_xflags);

@@ -66,6 +68,8 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 flags)
		fa->fsx_xflags |= FS_XFLAG_DAX;
	if (fa->flags & FS_PROJINHERIT_FL)
		fa->fsx_xflags |= FS_XFLAG_PROJINHERIT;
	if (fa->flags & FS_VERITY_FL)
		fa->fsx_xflags |= FS_XFLAG_VERITY;
}
EXPORT_SYMBOL(fileattr_fill_flags);

+4 −0
Original line number Diff line number Diff line
@@ -222,6 +222,8 @@ static int enable_verity(struct file *filp,
	if (err)
		goto out;

	trace_fsverity_enable(inode, &params);

	/*
	 * Start enabling verity on this file, serialized by the inode lock.
	 * Fail if verity is already enabled or is already being enabled.
@@ -264,6 +266,8 @@ static int enable_verity(struct file *filp,
		goto rollback;
	}

	trace_fsverity_tree_done(inode, vi, &params);

	/*
	 * Tell the filesystem to finish enabling verity on the file.
	 * Serialized with ->begin_enable_verity() by the inode lock.
+2 −0
Original line number Diff line number Diff line
@@ -161,4 +161,6 @@ static inline void fsverity_init_signature(void)

void __init fsverity_init_workqueue(void);

#include <trace/events/fsverity.h>

#endif /* _FSVERITY_PRIVATE_H */
Loading