Skip to contentSkip to conversation

Add traces and file attributes for fs-verity

PATCH Superseded Andrey Albershteyn 5 participants 10 messages Jan 19 – Jan 29

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add traces and file attributes for fs-verity

Hi all,

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

v2:
- Update kernel version in the docs to v7.0
- Move trace point before merkle tree block hash check
- Update commit message in patch 2
- Add VERITY to FS_COMMON_FL and FS_XFLAG_COMMON constants
- Fix block index argument in the tree block hash trace point

Andrey Albershteyn (2):
fs: add FS_XFLAG_VERITY for fs-verity files
fsverity: add tracepoints

 Documentation/filesystems/fsverity.rst |  16 +++
 MAINTAINERS                            |   1 +
 fs/file_attr.c                         |   4 +
 fs/verity/enable.c                     |   4 +
 fs/verity/fsverity_private.h           |   2 +
 fs/verity/init.c                       |   1 +
 fs/verity/verify.c                     |   9 ++
 include/linux/fileattr.h               |   6 +-
 include/trace/events/fsverity.h        | 143 +++++++++++++++++++++++++
 include/uapi/linux/fs.h                |   1 +
 10 files changed, 184 insertions(+), 3 deletions(-)
 create mode 100644 include/trace/events/fsverity.h
Signature · 1 line
2.52.0
#1 lore raw

PATCH v2 1/2 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.

---
 Documentation/filesystems/fsverity.rst | 16 ++++++++++++++++
 fs/file_attr.c                         |  4 ++++
 include/linux/fileattr.h               |  6 +++---
 include/uapi/linux/fs.h                |  1 +
 4 files changed, 24 insertions(+), 3 deletions(-)
Documentation/filesystems/fsverity.rst +16 -0
index 412cf11e3298..22b49b295d1f 100644
@@ -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
fs/file_attr.c +4 -0
index 13cdb31a3e94..f44c873af92b 100644
@@ -37,6 +37,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);
 
@@ -67,6 +69,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);
 
include/linux/fileattr.h +3 -3
index f89dcfad3f8f..3780904a63a6 100644
@@ -7,16 +7,16 @@
 #define FS_COMMON_FL \
 	(FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \
 	 FS_NODUMP_FL |	FS_NOATIME_FL | FS_DAX_FL | \
-	 FS_PROJINHERIT_FL)
+	 FS_PROJINHERIT_FL | FS_VERITY_FL)
 
 #define FS_XFLAG_COMMON \
 	(FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \
 	 FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \
-	 FS_XFLAG_PROJINHERIT)
+	 FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY)
 
 /* Read-only inode flags */
 #define FS_XFLAG_RDONLY_MASK \
-	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR)
+	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY)
 
 /* Flags to indicate valid value of fsx_ fields */
 #define FS_XFLAG_VALUES_MASK \
include/uapi/linux/fs.h +1 -0
index 66ca526cf786..70b2b661f42c 100644
@@ -253,6 +253,7 @@ struct file_attr {
 #define FS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
 #define FS_XFLAG_DAX		0x00008000	/* use DAX for IO */
 #define FS_XFLAG_COWEXTSIZE	0x00010000	/* CoW extent size allocator hint */
+#define FS_XFLAG_VERITY		0x00020000	/* fs-verity enabled */
 #define FS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this	*/
 
 /* the read-only stuff doesn't really belong here, but any other place is
Signature · 1 line
2.52.0
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] fs: add FS_XFLAG_VERITY for fs-verity files

Quoted 9 lines · Andrey Albershteyn

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.

Quoted 4 lines

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

Technically this uapi change should be cc'd to linux-api, but adding a flag definition is fairly minor so:

--D

Quoted 96 lines
---
 Documentation/filesystems/fsverity.rst | 16 ++++++++++++++++
 fs/file_attr.c                         |  4 ++++
 include/linux/fileattr.h               |  6 +++---
 include/uapi/linux/fs.h                |  1 +
 4 files changed, 24 insertions(+), 3 deletions(-)
Documentation/filesystems/fsverity.rst +16 -0
index 412cf11e3298..22b49b295d1f 100644
@@ -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
fs/file_attr.c +4 -0
index 13cdb31a3e94..f44c873af92b 100644
@@ -37,6 +37,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);
 
@@ -67,6 +69,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);
 
include/linux/fileattr.h +3 -3
index f89dcfad3f8f..3780904a63a6 100644
@@ -7,16 +7,16 @@
 #define FS_COMMON_FL \
 	(FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \
 	 FS_NODUMP_FL |	FS_NOATIME_FL | FS_DAX_FL | \
-	 FS_PROJINHERIT_FL)
+	 FS_PROJINHERIT_FL | FS_VERITY_FL)
 
 #define FS_XFLAG_COMMON \
 	(FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \
 	 FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \
-	 FS_XFLAG_PROJINHERIT)
+	 FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY)
 
 /* Read-only inode flags */
 #define FS_XFLAG_RDONLY_MASK \
-	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR)
+	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY)
 
 /* Flags to indicate valid value of fsx_ fields */
 #define FS_XFLAG_VALUES_MASK \
include/uapi/linux/fs.h +1 -0
index 66ca526cf786..70b2b661f42c 100644
@@ -253,6 +253,7 @@ struct file_attr {
 #define FS_XFLAG_FILESTREAM	0x00004000	/* use filestream allocator */
 #define FS_XFLAG_DAX		0x00008000	/* use DAX for IO */
 #define FS_XFLAG_COWEXTSIZE	0x00010000	/* CoW extent size allocator hint */
+#define FS_XFLAG_VERITY		0x00020000	/* fs-verity enabled */
 #define FS_XFLAG_HASATTR	0x80000000	/* no DIFLAG for this	*/
 
 /* the read-only stuff doesn't really belong here, but any other place is
Signature · 1 line
2.52.0
maintainer
#3 lore raw

Re: [PATCH v2 1/2] fs: add FS_XFLAG_VERITY for fs-verity files

In reply to Andrey Albershteyn

include/linux/fileattr.h line 19

Quoted 4 lines · Andrey Albershteyn

/* Read-only inode flags */
#define FS_XFLAG_RDONLY_MASK \

include/linux/fileattr.h +1 -1
-	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR)
+	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY)

This is the first flag that's both a common flag and a read-only flag.

Looking at how FS_XFLAG_RDONLY_MASK gets used in
copy_fsxattr_from_user():

    fileattr_fill_xflags(fa, xfa.fsx_xflags);
    fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;

So it translates the xflags into fsflags, then clears the read-only xflags *but not the read-only fsflags*.

If the user passed FS_XFLAG_VERITY, the result will be that FS_XFLAG_VERITY will *not* be set in xflags, but FS_VERITY_FL will be set in fsflags.

Is that working as intended? It seems inconsistent.

- Eric

#4 lore raw

Re: [PATCH v2 1/2] fs: add FS_XFLAG_VERITY for fs-verity files

Quoted 14 lines · Eric Biggers

include/linux/fileattr.h line 19

Quoted 4 lines · Andrey Albershteyn

/* Read-only inode flags */
#define FS_XFLAG_RDONLY_MASK \

include/linux/fileattr.h +1 -1
-	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR)
+	(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY)

This is the first flag that's both a common flag and a read-only flag.

Looking at how FS_XFLAG_RDONLY_MASK gets used in
copy_fsxattr_from_user():

    fileattr_fill_xflags(fa, xfa.fsx_xflags);
    fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
Quoted 8 lines

So it translates the xflags into fsflags, then clears the read-only xflags *but not the read-only fsflags*.

If the user passed FS_XFLAG_VERITY, the result will be that FS_XFLAG_VERITY will *not* be set in xflags, but FS_VERITY_FL will be set in fsflags.

Is that working as intended? It seems inconsistent.

Yeah, this seems wrong, thanks! I will send a patch

Signature · 1 line
- Andrey
#5 lore raw

PATCH v2 2/2 fsverity: add tracepoints

In reply to Andrey Albershteyn

fs-verity previously had debug printk but it was removed. This patch adds trace points to similar places, as a better alternative.

---
 MAINTAINERS                     |   1 +
 fs/verity/enable.c              |   4 +
 fs/verity/fsverity_private.h    |   2 +
 fs/verity/init.c                |   1 +
 fs/verity/verify.c              |   9 ++
 include/trace/events/fsverity.h | 143 ++++++++++++++++++++++++++++++++
 6 files changed, 160 insertions(+)
 create mode 100644 include/trace/events/fsverity.h
MAINTAINERS +1 -0
index 12f49de7fe03..17607340dfab 100644
@@ -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
fs/verity/enable.c +4 -0
index 95ec42b84797..8718d943b428 100644
@@ -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.
fs/verity/fsverity_private.h +2 -0
index dd20b138d452..4b7ae1748f4e 100644
@@ -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 */
fs/verity/init.c +1 -0
index 6e8d33b50240..d65206608583 100644
@@ -5,6 +5,7 @@
  * Copyright 2019 Google LLC
  */
 
+#define CREATE_TRACE_POINTS
 #include "fsverity_private.h"
 
 #include <linux/ratelimit.h>
fs/verity/verify.c +9 -0
index 86067c8b40cf..940b8b956d7e 100644
@@ -135,6 +135,9 @@ static bool verify_data_block(struct inode *inode, struct fsverity_info *vi,
 		/* Byte offset of the wanted hash relative to @addr */
 		unsigned int hoffset;
 	} hblocks[FS_VERITY_MAX_LEVELS];
+
+	trace_fsverity_verify_data_block(inode, params, data_pos);
+
 	/*
 	 * The index of the previous level's block within that level; also the
 	 * index of that block's hash within the current level.
@@ -214,6 +217,9 @@ static bool verify_data_block(struct inode *inode, struct fsverity_info *vi,
 			want_hash = _want_hash;
 			kunmap_local(haddr);
 			put_page(hpage);
+			trace_fsverity_merkle_hit(inode, data_pos, hblock_idx,
+					level,
+					hoffset >> params->log_digestsize);
 			goto descend;
 		}
 		hblocks[level].page = hpage;
@@ -232,6 +238,9 @@ static bool verify_data_block(struct inode *inode, struct fsverity_info *vi,
 		unsigned long hblock_idx = hblocks[level - 1].index;
 		unsigned int hoffset = hblocks[level - 1].hoffset;
 
+		trace_fsverity_verify_merkle_block(inode, hblock_idx,
+				level, hoffset >> params->log_digestsize);
+
 		fsverity_hash_block(params, haddr, real_hash);
 		if (memcmp(want_hash, real_hash, hsize) != 0)
 			goto corrupted;
include/trace/events/fsverity.h new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
2.52.0
maintainer
#6 lore raw

Re: [PATCH v2 2/2] fsverity: add tracepoints

On Mon, Jan 19, 2026 at 05:56:43PM +0100, Andrey Albershteyn wrote:
[...]

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu data size %llu tree size %llu block size %u levels %u",

[...]

include/trace/events/fsverity.h line 60

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu levels %d block_size %d tree_size %lld root_hash %s digest %s",

Would be nice to make these consistent. 3 of the parameters are the same, but the naming and order differs slightly.

[...]

include/trace/events/fsverity.h line 87

Quoted 4 lines
include/trace/events/fsverity.h new file +4 -0
+	TP_printk("ino %lu pos %lld merkle_blocksize %u",
+		(unsigned long) __entry->ino,
+		__entry->data_pos,
+		__entry->block_size)

Likewise here. So now we have "block size", "block_size", and "merkle_blocksize", all for the same thing.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	TP_printk("ino %lu data_pos %llu hblock_idx %lu level %u hidx %u",
+		(unsigned long) __entry->ino,

And here's data_pos as a %llu, whereas in the previous tracepoint it's just pos as an %lld.

include/trace/events/fsverity.h line 119

Quoted 3 lines
include/trace/events/fsverity.h new file +3 -0
+TRACE_EVENT(fsverity_verify_merkle_block,
+	TP_PROTO(const struct inode *inode, unsigned long index,
+		 unsigned int level, unsigned int hidx),

And the 'index' here is what the previous one calls 'hblock_idx'.

I think consistent naming would be helpful for people trying to use these tracepoints.

- Eric

maintainer
#7 lore raw

Re: [PATCH v2 2/2] fsverity: add tracepoints

[+Cc [email protected]]

Quoted 24 lines · Eric Biggers

On Mon, Jan 19, 2026 at 05:56:43PM +0100, Andrey Albershteyn wrote:
[...]

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu data size %llu tree size %llu block size %u levels %u",

[...]

include/trace/events/fsverity.h line 60

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu levels %d block_size %d tree_size %lld root_hash %s digest %s",

Would be nice to make these consistent. 3 of the parameters are the same, but the naming and order differs slightly.

[...]

include/trace/events/fsverity.h line 87

Quoted 4 lines
include/trace/events/fsverity.h new file +4 -0
+	TP_printk("ino %lu pos %lld merkle_blocksize %u",
+		(unsigned long) __entry->ino,
+		__entry->data_pos,
+		__entry->block_size)

Likewise here. So now we have "block size", "block_size", and "merkle_blocksize", all for the same thing.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	TP_printk("ino %lu data_pos %llu hblock_idx %lu level %u hidx %u",
+		(unsigned long) __entry->ino,

And here's data_pos as a %llu, whereas in the previous tracepoint it's just pos as an %lld.

Quoted 8 lines

include/trace/events/fsverity.h line 119

Quoted 3 lines
include/trace/events/fsverity.h new file +3 -0
+TRACE_EVENT(fsverity_verify_merkle_block,
+	TP_PROTO(const struct inode *inode, unsigned long index,
+		 unsigned int level, unsigned int hidx),

And the 'index' here is what the previous one calls 'hblock_idx'.

I think consistent naming would be helpful for people trying to use these tracepoints.

Andrey, let me know if you're planning to send a new version with the naming cleaned up, or if I should do it in a follow-up patch instead.

Christian, can you let me know if it's okay if I take this series through the fsverity tree, or do you want it to go through the VFS tree?

Thanks,

- Eric

#8 lore raw

Re: [PATCH v2 2/2] fsverity: add tracepoints

Quoted 1 line · Eric Biggers

[+Cc [email protected]]

ops, wrong autocomplete, thanks!

Quoted 32 lines · Eric Biggers
Quoted 30 lines · Andrey Albershteyn

[...]

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu data size %llu tree size %llu block size %u levels %u",

[...]

include/trace/events/fsverity.h line 60

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu levels %d block_size %d tree_size %lld root_hash %s digest %s",

Would be nice to make these consistent. 3 of the parameters are the same, but the naming and order differs slightly.

[...]

include/trace/events/fsverity.h line 87

Quoted 4 lines
include/trace/events/fsverity.h new file +4 -0
+	TP_printk("ino %lu pos %lld merkle_blocksize %u",
+		(unsigned long) __entry->ino,
+		__entry->data_pos,
+		__entry->block_size)

Likewise here. So now we have "block size", "block_size", and "merkle_blocksize", all for the same thing.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	TP_printk("ino %lu data_pos %llu hblock_idx %lu level %u hidx %u",
+		(unsigned long) __entry->ino,

And here's data_pos as a %llu, whereas in the previous tracepoint it's just pos as an %lld.

include/trace/events/fsverity.h line 119

Quoted 3 lines
include/trace/events/fsverity.h new file +3 -0
+TRACE_EVENT(fsverity_verify_merkle_block,
+	TP_PROTO(const struct inode *inode, unsigned long index,
+		 unsigned int level, unsigned int hidx),

And the 'index' here is what the previous one calls 'hblock_idx'.

Quoted 5 lines
Quoted 2 lines

I think consistent naming would be helpful for people trying to use these tracepoints.

Andrey, let me know if you're planning to send a new version with the naming cleaned up, or if I should do it in a follow-up patch instead.

I will send v2 with renames

Signature · 1 line
- Andrey
#9 lore raw

Re: [PATCH v2 2/2] fsverity: add tracepoints

In reply to Eric Biggers
Quoted 33 lines · Eric Biggers

[+Cc [email protected]]

Quoted 30 lines · Eric Biggers

On Mon, Jan 19, 2026 at 05:56:43PM +0100, Andrey Albershteyn wrote:
[...]

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu data size %llu tree size %llu block size %u levels %u",

[...]

include/trace/events/fsverity.h line 60

Quoted 1 line
include/trace/events/fsverity.h new file +1 -0
+	TP_printk("ino %lu levels %d block_size %d tree_size %lld root_hash %s digest %s",

Would be nice to make these consistent. 3 of the parameters are the same, but the naming and order differs slightly.

[...]

include/trace/events/fsverity.h line 87

Quoted 4 lines
include/trace/events/fsverity.h new file +4 -0
+	TP_printk("ino %lu pos %lld merkle_blocksize %u",
+		(unsigned long) __entry->ino,
+		__entry->data_pos,
+		__entry->block_size)

Likewise here. So now we have "block size", "block_size", and "merkle_blocksize", all for the same thing.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	TP_printk("ino %lu data_pos %llu hblock_idx %lu level %u hidx %u",
+		(unsigned long) __entry->ino,

And here's data_pos as a %llu, whereas in the previous tracepoint it's just pos as an %lld.

include/trace/events/fsverity.h line 119

Quoted 3 lines
include/trace/events/fsverity.h new file +3 -0
+TRACE_EVENT(fsverity_verify_merkle_block,
+	TP_PROTO(const struct inode *inode, unsigned long index,
+		 unsigned int level, unsigned int hidx),

And the 'index' here is what the previous one calls 'hblock_idx'.

Quoted 8 lines
Quoted 2 lines

I think consistent naming would be helpful for people trying to use these tracepoints.

Andrey, let me know if you're planning to send a new version with the naming cleaned up, or if I should do it in a follow-up patch instead.

Christian, can you let me know if it's okay if I take this series through the fsverity tree, or do you want it to go through the VFS tree?

Yeah, I can take them no biggie.
Tracepoints, heh, who would've thought.