All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ricardo AlgRicSpain <algricspain@gmail.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-block@vger.kernel.org
Subject: Re: block/t10-pi.c: blk_integrity_interval() prot_iter misalignment with extended metadata
Date: Thu, 13 Aug 2026 23:38:31 -0700	[thread overview]
Message-ID: <an6359QSC05yHdZg@infradead.org> (raw)
In-Reply-To: <CAOeC6wqyPMoUohXg9v=BxHYWmPncR_243CC2P=bptAaPvQXp+Q@mail.gmail.com>

On Wed, Aug 12, 2026 at 02:37:28PM +0200, Ricardo AlgRicSpain wrote:
> Hi,
> 
> blk_integrity_interval() (block/t10-pi.c:270-305) advances prot_iter
> inconsistently:
> 
> - fast path (t10-pi.c:282): advances metadata_size - pi_offset bytes
> - split-tuple path (t10-pi.c:285-287, 296-299): advances only
>   pi_tuple_size bytes via blk_integrity_copy_to_tuple/copy_from_tuple
> 
> When metadata_size - pi_offset > pi_tuple_size (e.g. NVMe extended
> metadata) and the tuple splits across bvec segments, prot_iter
> under-advances by the trailing opaque bytes, and the offset accumulates
> across subsequent intervals, breaking guard/data correspondence on
> verify and generate.
> 
> Suggested fix: after copy_to_tuple/copy_from_tuple, advance the
> remaining bytes:
> 
>     bvec_iter_advance(iter->bip->bip_vec, &iter->prot_iter,
>             iter->bi->metadata_size - iter->bi->pi_offset -
>             iter->bi->pi_tuple_size);
> 
> ...matching what blk_tuple_remap_end() already does (t10-pi.c:426-436).
> 
> Standalone C PoC reproducing the misalignment attached (poc.c).

Please send a patch with your proposed fix.  Wiring up your reproducer
in blktests would also be very helpful.


      reply	other threads:[~2026-08-14  6:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 12:37 block/t10-pi.c: blk_integrity_interval() prot_iter misalignment with extended metadata Ricardo AlgRicSpain
2026-08-14  6:38 ` Christoph Hellwig [this message]

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=an6359QSC05yHdZg@infradead.org \
    --to=hch@infradead.org \
    --cc=algricspain@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.