From: Eric Biggers <ebiggers@kernel.org>
To: Yeongjin Gil <youngjin.gil@samsung.com>
Cc: snitzer@kernel.org, totte@google.com,
linux-kernel@vger.kernel.org,
Nathan Huckleberry <nhuck@google.com>,
dm-devel@redhat.com, Sami Tolvanen <samitolvanen@google.com>,
Sungjong Seo <sj1557.seo@samsung.com>,
agk@redhat.com
Subject: Re: [dm-devel] [PATCH] dm verity: fix error handling for check_at_most_once
Date: Thu, 16 Mar 2023 18:44:00 +0000 [thread overview]
Message-ID: <ZBNjcA1feNWUxvaW@gmail.com> (raw)
In-Reply-To: <20230316031842.17295-1-youngjin.gil@samsung.com>
Hi Yeongjin,
On Thu, Mar 16, 2023 at 12:18:42PM +0900, Yeongjin Gil wrote:
> In verity_work(), the return value of verity_verify_io() is converted to
> blk_status and passed to verity_finish_io(). BTW, when a bit is set in
> v->validated_blocks, verity_verify_io() skips verification regardless of
> I/O error for the corresponding bio. In this case, the I/O error could
> not be returned properly, and as a result, there is a problem that
> abnormal data could be read for the corresponding block.
>
> To fix this problem, when an I/O error occurs, do not skip verification
> even if the bit related is set in v->validated_blocks.
>
> Fixes: 843f38d382b1 ("dm verity: add 'check_at_most_once' option to only validate hashes once")
>
> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
> Signed-off-by: Yeongjin Gil <youngjin.gil@samsung.com>
> ---
> drivers/md/dm-verity-target.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index ade83ef3b439..9316399b920e 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -523,7 +523,7 @@ static int verity_verify_io(struct dm_verity_io *io)
> sector_t cur_block = io->block + b;
> struct ahash_request *req = verity_io_hash_req(v, io);
>
> - if (v->validated_blocks &&
> + if (v->validated_blocks && bio->bi_status == BLK_STS_OK &&
> likely(test_bit(cur_block, v->validated_blocks))) {
> verity_bv_skip_block(v, io, iter);
> continue;
Thanks for sending this patch! This looks like a correct fix, but I have some
comments:
* Using "check_at_most_once" is strongly discouraged, as it reduces security.
If you are using check_at_most_once to improve performance at the cost of
reduced security, please consider that very recently, dm-verity performance
has significantly improved due to the removal of the WQ_UNBOUND workqueue flag
which was causing significant I/O latency. See commit c25da5b7baf1
("dm verity: stop using WQ_UNBOUND for verify_wq").
* I think your commit message does not explain a key aspect of the problem which
is why is verity even attempted when the underlying I/O has failed? This
appears to be because of the Forward Error Correction (FEC) feature. So, this
issue is specific to the case where both FEC and check_at_most_once is used.
Can you make your commit message explain this?
* This patch does not appear to have been received by the dm-devel mailing list,
which is the list where dm-verity patches should be reviewed on. It doesn't
show up in the archive at https://lore.kernel.org/dm-devel. Also, I'm
subscribed to dm-devel and I didn't receive this patch in my inbox. (I had to
download it from https://lore.kernel.org/lkml instead.) Did you receive a
bounce message when you sent this patch?
* Please add 'Cc: stable@vger.kernel.org' to the commit message, just below the
Fixes line, as per Documentation/process/stable-kernel-rules.rst. This will
ensure that the fix will be backported to the stable kernels.
* "Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>" does not have a
corresponding Author or Co-developed-line, which is not allowed. Did you mean
to list Sungjong as the Author or as a co-author?
* No blank line between Fixes and the Signed-off-by line(s), please.
Thanks!
- Eric
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Yeongjin Gil <youngjin.gil@samsung.com>
Cc: agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com,
totte@google.com, linux-kernel@vger.kernel.org,
Sungjong Seo <sj1557.seo@samsung.com>,
Nathan Huckleberry <nhuck@google.com>,
Sami Tolvanen <samitolvanen@google.com>
Subject: Re: [PATCH] dm verity: fix error handling for check_at_most_once
Date: Thu, 16 Mar 2023 18:44:00 +0000 [thread overview]
Message-ID: <ZBNjcA1feNWUxvaW@gmail.com> (raw)
In-Reply-To: <20230316031842.17295-1-youngjin.gil@samsung.com>
Hi Yeongjin,
On Thu, Mar 16, 2023 at 12:18:42PM +0900, Yeongjin Gil wrote:
> In verity_work(), the return value of verity_verify_io() is converted to
> blk_status and passed to verity_finish_io(). BTW, when a bit is set in
> v->validated_blocks, verity_verify_io() skips verification regardless of
> I/O error for the corresponding bio. In this case, the I/O error could
> not be returned properly, and as a result, there is a problem that
> abnormal data could be read for the corresponding block.
>
> To fix this problem, when an I/O error occurs, do not skip verification
> even if the bit related is set in v->validated_blocks.
>
> Fixes: 843f38d382b1 ("dm verity: add 'check_at_most_once' option to only validate hashes once")
>
> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
> Signed-off-by: Yeongjin Gil <youngjin.gil@samsung.com>
> ---
> drivers/md/dm-verity-target.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index ade83ef3b439..9316399b920e 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -523,7 +523,7 @@ static int verity_verify_io(struct dm_verity_io *io)
> sector_t cur_block = io->block + b;
> struct ahash_request *req = verity_io_hash_req(v, io);
>
> - if (v->validated_blocks &&
> + if (v->validated_blocks && bio->bi_status == BLK_STS_OK &&
> likely(test_bit(cur_block, v->validated_blocks))) {
> verity_bv_skip_block(v, io, iter);
> continue;
Thanks for sending this patch! This looks like a correct fix, but I have some
comments:
* Using "check_at_most_once" is strongly discouraged, as it reduces security.
If you are using check_at_most_once to improve performance at the cost of
reduced security, please consider that very recently, dm-verity performance
has significantly improved due to the removal of the WQ_UNBOUND workqueue flag
which was causing significant I/O latency. See commit c25da5b7baf1
("dm verity: stop using WQ_UNBOUND for verify_wq").
* I think your commit message does not explain a key aspect of the problem which
is why is verity even attempted when the underlying I/O has failed? This
appears to be because of the Forward Error Correction (FEC) feature. So, this
issue is specific to the case where both FEC and check_at_most_once is used.
Can you make your commit message explain this?
* This patch does not appear to have been received by the dm-devel mailing list,
which is the list where dm-verity patches should be reviewed on. It doesn't
show up in the archive at https://lore.kernel.org/dm-devel. Also, I'm
subscribed to dm-devel and I didn't receive this patch in my inbox. (I had to
download it from https://lore.kernel.org/lkml instead.) Did you receive a
bounce message when you sent this patch?
* Please add 'Cc: stable@vger.kernel.org' to the commit message, just below the
Fixes line, as per Documentation/process/stable-kernel-rules.rst. This will
ensure that the fix will be backported to the stable kernels.
* "Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>" does not have a
corresponding Author or Co-developed-line, which is not allowed. Did you mean
to list Sungjong as the Author or as a co-author?
* No blank line between Fixes and the Signed-off-by line(s), please.
Thanks!
- Eric
next prev parent reply other threads:[~2023-03-17 14:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230316031936epcas1p1ebd93477dcf3bf9ab1640306dd1da8ff@epcas1p1.samsung.com>
2023-03-16 3:18 ` [dm-devel] [PATCH] dm verity: fix error handling for check_at_most_once Yeongjin Gil
2023-03-16 3:18 ` Yeongjin Gil
2023-03-16 18:44 ` Eric Biggers [this message]
2023-03-16 18:44 ` Eric Biggers
2023-03-17 6:18 ` [dm-devel] " 길영진/System Core Lab.(MX)/삼성전자
2023-03-17 6:18 ` 길영진/System Core Lab.(MX)/삼성전자
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=ZBNjcA1feNWUxvaW@gmail.com \
--to=ebiggers@kernel.org \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nhuck@google.com \
--cc=samitolvanen@google.com \
--cc=sj1557.seo@samsung.com \
--cc=snitzer@kernel.org \
--cc=totte@google.com \
--cc=youngjin.gil@samsung.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.