From: Max Reitz <mreitz@redhat.com>
To: Maxim Levitsky <mlevitsk@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org, qemu-stable <qemu-stable@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files
Date: Fri, 13 Sep 2019 12:52:43 +0200 [thread overview]
Message-ID: <af1b9cf1-2ea9-72e4-da3f-bdcf3e485c88@redhat.com> (raw)
In-Reply-To: <20190912223754.875-3-mlevitsk@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1767 bytes --]
On 13.09.19 00:37, Maxim Levitsky wrote:
> This fixes subtle corruption introduced by luks threaded encryption
> in commit 8ac0f15f335
>
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1745922
>
> The corruption happens when we do a write that
> * writes to two or more unallocated clusters at once
> * doesn't fully cover the first sector
> * doesn't fully cover the last sector
>
> In this case, when allocating the new clusters we COW both areas
> prior to the write and after the write, and we encrypt them.
>
> The above mentioned commit accidentally made it so we encrypt the
> second COW area using the physical cluster offset of the first area.
>
> Fix this by:
> * Remove the offset_in_cluster parameter of do_perform_cow_encrypt,
> since it is misleading. That offset can be larger than cluster size
> currently.
>
> Instead just add the start and the end COW area offsets to both host
> and guest offsets that do_perform_cow_encrypt receives.
>
> * in do_perform_cow_encrypt, remove the cluster offset from the host_offset,
> and thus pass correctly to the qcow2_co_encrypt, the host cluster offset
> and full guest offset
>
> In the bugreport that was triggered by rebasing a luks image to new,
> zero filled base, which lot of such writes, and causes some files
> with zero areas to contain garbage there instead.
> But as described above it can happen elsewhere as well
>
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> block/qcow2-cluster.c | 29 +++++++++++++++++------------
> 1 file changed, 17 insertions(+), 12 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-09-13 10:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 22:37 [Qemu-devel] [PATCH v3 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335 Maxim Levitsky
2019-09-12 22:37 ` [Qemu-devel] [PATCH v3 1/3] block/qcow2: refactoring of threaded encryption code Maxim Levitsky
2019-09-13 10:37 ` Max Reitz
2019-09-13 13:21 ` Maxim Levitsky
2019-09-12 22:37 ` [Qemu-devel] [PATCH v3 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files Maxim Levitsky
2019-09-13 10:52 ` Max Reitz [this message]
2019-09-12 22:37 ` [Qemu-devel] [PATCH v3 3/3] qemu-iotests: Add test for bz #1745922 Maxim Levitsky
2019-09-13 11:01 ` Max Reitz
2019-09-13 11:53 ` Maxim Levitsky
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=af1b9cf1-2ea9-72e4-da3f-bdcf3e485c88@redhat.com \
--to=mreitz@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=vsementsov@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).