All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "周伟江 (Weijiang Zhou)" <weijiang.zhou@unisoc.com>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Mikulas Patocka" <mpatocka@redhat.com>
Cc: "dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>,
	"samitolvanen@google.com" <samitolvanen@google.com>,
	"agk@redhat.com" <agk@redhat.com>,
	"snitzer@kernel.org" <snitzer@kernel.org>,
	"bmarzins@redhat.com" <bmarzins@redhat.com>,
	"金红宇 (Hongyu Jin)" <hongyu.jin@unisoc.com>,
	"吴祥禄 (Xianglu Wu)" <Xianglu.Wu@unisoc.com>,
	"吴周镜 (Justin Wu)" <Justin.Wu@unisoc.com>,
	"耿慈熙 (Cixi Geng/10039)" <Cixi.Geng1@unisoc.com>
Subject: Re: [RFC PATCH v3 3/3] dm-verity: avoid corruption policy during FEC erasure lookup
Date: Fri, 04 Dec 2026 05:33:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-249147@kernel.org> (raw)
In-Reply-To: <e77df1008ddfc7f17d8b1e40cf5c44e1@zeshmbx08.spreadtrum.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] dm-verity: changelog and fec_read_bufs() comment misattribute
  I/O errors
- [Low] dm-verity: missing Fixes trailer for commit a739ff3f543a
--

commit d8c123c7e724990ed762b6e89229b7699e6da1fb
Author: 周伟江 (Weijiang Zhou) <weijiang.zhou@unisoc.com>

> dm-verity: avoid corruption policy during FEC erasure lookup
>
> fec_read_bufs() walks the hash tree through verity_hash_for_block()
> only to find out which blocks of the RS codeword are erasures.  That
> walk is speculative: a verification failure only means that erasure
> information is unavailable, yet it goes through verity_handle_err(), so
> an I/O error during the walk triggers the corruption policy - a restart
> or panic - instead of degrading to correction without erasure
> information.
>
> Add a per-I/O erasure lookup flag to dm_verity_io, initialize it in
> verity_map(), and set it only around the synchronous hash tree walk in
> fec_read_bufs().  While the flag is set, a speculative verification
> failure returns -EIO without invoking the corruption policy or
> recording a mismatch.  Real corruption found on the normal verification
> path is still handled as before.
>
> Signed-off-by: weijiang.zhou <weijiang.zhou@unisoc.com>

[Severity: Low]
This looks like a bug fix for FEC erasure lookups invoking
verity_handle_err().  Should this include:

  Fixes: a739ff3f543a ("dm verity: add support for forward error correction")

> diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
> index 396fe5e3db858..bab2fdc8b6f33 100644
> --- a/drivers/md/dm-verity-fec.c
> +++ b/drivers/md/dm-verity-fec.c

[ ... ]

> @@ -227,20 +227,30 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io,
>  		}
>  
>  		/* locate erasures if the block is on the data device */
> -		if (bufio == v->fec->data_bufio &&
> -		    verity_hash_for_block(v, io, block, want_digest,
> -					  &is_zero) == 0) {
> -			/* skip known zero blocks entirely */
> -			if (is_zero)
> -				goto done;
> -
> +		if (bufio == v->fec->data_bufio) {
>  			/*
> -			 * skip if we have already found the theoretical
> -			 * maximum number (i.e. fec->roots) of erasures
> +			 * This hash tree walk is speculative: a failure only
> +			 * means erasure information is unavailable.  Suppress
> +			 * the corruption policy while it runs, so that an
> +			 * I/O error here cannot restart or panic the system.
>  			 */
> -			if (neras && *neras < v->fec->roots &&
> -			    fec_is_erasure(v, io, want_digest, bbuf))
> -				fio->erasures[(*neras)++] = i;
> +			io->fec_erasure_lookup = true;
> +			r = verity_hash_for_block(v, io, block, want_digest,
> +						  &is_zero);
> +			io->fec_erasure_lookup = false;

[Severity: Low]
Is the reference to I/O errors accurate here and in the commit message?

In verity_verify_level(), hash block read I/O errors return ERR_PTR() from
dm_bufio_read_with_ioprio() and take the IS_ERR(data) branch, returning
without calling verity_handle_err() or checking io->fec_erasure_lookup.

The new io->fec_erasure_lookup check is only reached after the read succeeds
and verity_hash() finds a metadata digest mismatch, such as a corrupted hash
block while recursive FEC is blocked.

Also, fec_read_bufs() walks the hash tree on the first pass when neras is
NULL to identify zero blocks, not solely to locate erasures.  Updating the
comment and commit message to describe metadata hash verification mismatches
would make this accurate.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/f55322e3a71277d927476ddb372064e0@zeshmbx08.spreadtrum.com?part=3

  reply	other threads:[~2026-12-04  5:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 13:06 [RFC PATCH 0/2] dm-verity: don't let FEC decode into a dm_bufio page that is already in the cache 周伟江 (Weijiang Zhou)
2026-11-10 13:06 ` [RFC PATCH 1/2] dm-verity: don't decode FEC " 周伟江 (Weijiang Zhou)
2026-11-10 21:08   ` Mikulas Patocka
2026-11-11  3:14     ` 周伟江 (Weijiang Zhou)
2026-11-11 23:33       ` Mikulas Patocka
2026-11-12  0:38     ` Sami Tolvanen
2026-11-13  5:36     ` Eric Biggers
2026-11-19 13:22       ` 周伟江 (Weijiang Zhou)
2026-12-02 13:05         ` 周伟江 (Weijiang Zhou)
2026-12-02 19:04           ` Eric Biggers
2026-12-03  8:51             ` [RFC PATCH v2 0/4] dm-verity: fix FEC turning I/O errors into corruption reports 周伟江 (Weijiang Zhou)
2026-12-03  8:51               ` [RFC PATCH v2 1/4] dm-verity: don't restart or panic on errors during system shutdown 周伟江 (Weijiang Zhou)
2026-12-03  8:51               ` [RFC PATCH v2 2/4] dm-bufio: support atomic publication of pre-filled buffers 周伟江 (Weijiang Zhou)
2026-12-03  8:51               ` [RFC PATCH v2 3/4] dm-verity: prevent FEC from publishing uninitialized hash blocks 周伟江 (Weijiang Zhou)
2026-12-03  8:51               ` [RFC PATCH v2 4/4] dm-verity: avoid corruption policy during FEC erasure lookup 周伟江 (Weijiang Zhou)
2026-12-03 11:07               ` [RFC PATCH v2 0/4] dm-verity: fix FEC turning I/O errors into corruption reports 周伟江 (Weijiang Zhou)
2026-12-03 18:41                 ` Eric Biggers
2026-12-04  5:19                   ` [RFC PATCH v3 0/3] dm-verity: fix FEC recovery of hash blocks and spurious corruption policy 周伟江 (Weijiang Zhou)
2026-12-04  5:19                     ` [RFC PATCH v3 1/3] dm-bufio: support atomic publication of pre-filled buffers 周伟江 (Weijiang Zhou)
2026-12-04  5:34                       ` sashiko-bot
2026-12-04  5:19                     ` [RFC PATCH v3 2/3] dm-verity: prevent FEC from publishing uninitialized hash blocks 周伟江 (Weijiang Zhou)
2026-12-04  5:36                       ` sashiko-bot
2026-12-04  5:19                     ` [RFC PATCH v3 3/3] dm-verity: avoid corruption policy during FEC erasure lookup 周伟江 (Weijiang Zhou)
2026-12-04  5:33                       ` sashiko-bot [this message]
2026-11-10 13:06 ` [RFC PATCH 2/2] dm-verity: don't restart or panic on errors during system shutdown 周伟江 (Weijiang Zhou)
2026-11-10 21:13   ` Mikulas Patocka
2026-11-11  3:14     ` 周伟江 (Weijiang Zhou)
2026-11-11 22:48       ` Mikulas Patocka
2026-11-13  5:55   ` Eric Biggers
2026-11-13  7:40     ` 回复: " 周伟江 (Weijiang Zhou)

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=sashiko-outbox-249147@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Cixi.Geng1@unisoc.com \
    --cc=Justin.Wu@unisoc.com \
    --cc=Xianglu.Wu@unisoc.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=hongyu.jin@unisoc.com \
    --cc=mpatocka@redhat.com \
    --cc=samitolvanen@google.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=snitzer@kernel.org \
    --cc=weijiang.zhou@unisoc.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.