public inbox for fsverity@lists.linux.dev
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: fsverity@lists.linux.dev, aalbersh@kernel.org, djwong@kernel.org
Subject: Re: [PATCH 2/2] fsverity: add tracepoints
Date: Sat, 17 Jan 2026 15:33:10 -0800	[thread overview]
Message-ID: <20260117233310.GB74518@quark> (raw)
In-Reply-To: <3wrdpbzuximevxhielsz5kjzwkbdxhk6dhgzwug4dbj6c3r4ek@dvngy452w2jt>

On Mon, Jan 12, 2026 at 01:15:02PM +0100, Andrey Albershteyn wrote:
> fs-verity previously had debug printk but it was removed. This patch
> adds trace points to the same places where printk were used (with a
> few additional ones).

They're not the same places.  Which is the right choice: the locations
of the old debug messages aren't necessarily the places the tracepoints
should be.  But the commit message shouldn't claim otherwise.

> diff --git a/fs/verity/verify.c b/fs/verity/verify.c
> index 86067c8b40..47a66f088f 100644
> --- a/fs/verity/verify.c
> +++ b/fs/verity/verify.c
> @@ -135,6 +135,9 @@
>  		/* 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 @@
>  			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;
> @@ -248,6 +254,9 @@
>  		want_hash = _want_hash;
>  		kunmap_local(haddr);
>  		put_page(hpage);
> +		trace_fsverity_verify_merkle_block(inode,
> +				hblock_idx << params->log_blocksize,
> +				level, hoffset >> params->log_digestsize);
>  	}

The second argument to trace_fsverity_verify_merkle_block() is wrong.
It's "unsigned long index", but the caller passes a byte position.  Note
that byte positions should be u64.  Perhaps you intended for it to be
"unsigned long hblock_idx", like trace_fsverity_merkle_hit(), and for
the caller to pass hblock_idx?

Also note that if the hash doesn't match, then
trace_fsverity_verify_merkle_block() isn't called.  Perhaps it should be
called before the hash check is done?  That's the case for
trace_fsverity_verify_data_block().

- Eric

  reply	other threads:[~2026-01-17 23:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 12:13 [PATCH 0/3] Add traces and file attributes for fs-verity Andrey Albershteyn
2026-01-12 12:14 ` [PATCH 1/2] fs: add FS_XFLAG_VERITY for fs-verity files Andrey Albershteyn
2026-01-12 22:02   ` Darrick J. Wong
2026-01-13 10:07     ` Andrey Albershteyn
2026-01-17 23:15   ` Eric Biggers
2026-01-12 12:15 ` [PATCH 2/2] fsverity: add tracepoints Andrey Albershteyn
2026-01-17 23:33   ` Eric Biggers [this message]
2026-01-17 23:34 ` [PATCH 0/3] Add traces and file attributes for fs-verity Eric Biggers

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=20260117233310.GB74518@quark \
    --to=ebiggers@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=aalbersh@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fsverity@lists.linux.dev \
    /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