Unverified Commit fa19d42c authored by Andrey Albershteyn's avatar Andrey Albershteyn Committed by Christian Brauner
Browse files

fsverity: add tracepoints



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

Signed-off-by: default avatarAndrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
[djwong: fix formatting]
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Link: https://patch.msgid.link/20260126115658.27656-3-aalbersh@kernel.org


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 0e6b7eae
Loading
Loading
Loading
Loading
+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
@@ -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 */
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 * Copyright 2019 Google LLC
 */

#define CREATE_TRACE_POINTS
#include "fsverity_private.h"

#include <linux/ratelimit.h>
+9 −0
Original line number Diff line number Diff line
@@ -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;
Loading