[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH 2/3] block/qcow2: fix the corrupti
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files |
Date: |
Mon, 9 Sep 2019 12:56:55 +0200 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
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.
Kevin
signature.asc
Description: PGP signature
[Qemu-stable] [PATCH 2/3] block/qcow2: fix the corruption when rebasing luks encrypted files, Maxim Levitsky, 2019/09/06
[Qemu-stable] [PATCH 3/3] qemu-iotests: test for bz #1745922, Maxim Levitsky, 2019/09/06
Re: [Qemu-stable] [Qemu-devel] [PATCH 0/3] Fix qcow2+luks corruption introduced by commit 8ac0f15f335, Maxim Levitsky, 2019/09/06