From: Maxim Levitsky <mlevitsk@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>
Cc: "Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
qemu-stable <qemu-stable@nongnu.org>,
"Max Reitz" <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files
Date: Tue, 10 Sep 2019 14:12:00 +0300 [thread overview]
Message-ID: <0c3a04b8b7aaae75230e1b37c5b2fae7800fec4a.camel@redhat.com> (raw)
In-Reply-To: <20190909105655.GE17606@localhost.localdomain>
On Mon, 2019-09-09 at 12:56 +0200, Kevin Wolf wrote:
> Am 06.09.2019 um 21:17 hat Eric Blake geschrieben:
> > > - assert((offset_in_cluster & ~BDRV_SECTOR_MASK) == 0);
> > > + assert((guest_offset & ~BDRV_SECTOR_MASK) == 0);
> > > + assert((host_offset & ~BDRV_SECTOR_MASK) == 0);
> > > assert((bytes & ~BDRV_SECTOR_MASK) == 0);
> >
> > Pre-existing, but we could use QEMU_IS_ALIGNED(x, BDRV_SECTOR_SIZE) for
> > slightly more legibility than open-coding the bit operation.
> >
> > Neat trick about power-of-2 alignment checks:
> >
> > assert(QEMU_IS_ALIGNED(offset_in_cluster | guest_offset |
> > host_offset | bytes, BDRV_SECTOR_SIZE));
> >
> > gives the same result in one assertion. (I've used it elsewhere in the
> > code base, but I'm not opposed to one assert per variable if you think
> > batching is too dense.)
>
> A possible downside of this is that if a user reports an assertion
> failure, you can't tell any more which of the variables ended up in a
> bad state.
>
> If you're lucky, you can still tell in gdb at least if the bug is
> reproducible, but I wouldn't be surprised if in release builds, half of
> the variables were actually optimised away, so that even this wouldn't
> work.
Agreed. I guess I'll keep the separate asserts anyway after all, even though
I prefer shorter code.
Best regards,
Maxim Levitsky
next prev parent reply other threads:[~2019-09-10 11:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 17:31 [Qemu-devel] [PATCH 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335 Maxim Levitsky
2019-09-06 17:31 ` [Qemu-devel] [PATCH 1/3] block/qcow2: refactoring of threaded encryption code Maxim Levitsky
2019-09-06 18:00 ` Eric Blake
2019-09-06 18:55 ` Maxim Levitsky
2019-09-06 19:00 ` Eric Blake
2019-09-06 19:03 ` Maxim Levitsky
2019-09-06 17:32 ` [Qemu-devel] [PATCH 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files Maxim Levitsky
2019-09-06 19:17 ` Eric Blake
2019-09-06 19:46 ` Maxim Levitsky
2019-09-09 10:56 ` Kevin Wolf
2019-09-10 11:12 ` Maxim Levitsky [this message]
2019-09-06 17:32 ` [Qemu-devel] [PATCH 3/3] qemu-iotests: test for bz #1745922 Maxim Levitsky
2019-09-06 17:37 ` [Qemu-devel] [PATCH 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335 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=0c3a04b8b7aaae75230e1b37c5b2fae7800fec4a.camel@redhat.com \
--to=mlevitsk@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).