[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 47/99] qemu-img: Fix assert when mapping unaligned
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 47/99] qemu-img: Fix assert when mapping unaligned raw file |
Date: |
Mon, 23 Jul 2018 15:16:56 -0500 |
From: Eric Blake <address@hidden>
Commit a290f085 exposed a latent bug in qemu-img map introduced
during the conversion of block status to be byte-based. Earlier in
commit 5e344dd8, the internal interface get_block_status() switched
to take byte-based parameters, but still called a sector-based
block layer function; as such, rounding was added in the lone
caller to obey the contract. However, commit 237d78f8 changed
get_block_status() to truly be byte-based, at which point rounding
to sector boundaries can result in calling bdrv_block_status() with
'bytes == 0' (a coding error) when the boundary between data and a
hole falls mid-sector (true for the past-EOF implicit hole present
in POSIX files). Fix things by removing the rounding that is now
no longer necessary.
See also https://bugzilla.redhat.com/1589738
Fixes: 237d78f8
Reported-by: Dan Kenigsberg <address@hidden>
Reported-by: Nir Soffer <address@hidden>
Reported-by: Maor Lipchuk <address@hidden>
CC: address@hidden
Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
(cherry picked from commit e0b371ed5e2db079051139136fd0478728b6a58f)
Signed-off-by: Michael Roth <address@hidden>
---
qemu-img.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
index b422fda6f3..a8e2b53dc6 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2827,7 +2827,7 @@ static int img_map(int argc, char **argv)
int64_t n;
/* Probe up to 1 GiB at a time. */
- n = QEMU_ALIGN_DOWN(MIN(1 << 30, length - offset), BDRV_SECTOR_SIZE);
+ n = MIN(1 << 30, length - offset);
ret = get_block_status(bs, offset, n, &next);
if (ret < 0) {
--
2.17.1
- [Qemu-stable] [PATCH 39/99] qcow2: Do not mark inactive images corrupt, (continued)
- [Qemu-stable] [PATCH 39/99] qcow2: Do not mark inactive images corrupt, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 37/99] arm_gicv3_kvm: kvm_dist_get/put: skip the registers banked by GICR, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 40/99] iotests: Add case for a corrupted inactive image, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 03/99] ccid: Fix dwProtocols advertisement of T=0, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 41/99] throttle: Fix crash on reopen, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 42/99] i386: define the 'ssbd' CPUID feature bit (CVE-2018-3639), Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 43/99] i386: Define the Virt SSBD MSR and handling of it (CVE-2018-3639), Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 44/99] i386: define the AMD 'virt-ssbd' CPUID feature bit (CVE-2018-3639), Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 46/99] vhost-user: delete net client if necessary, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 45/99] tap: set vhostfd passed from qemu cli to non-blocking, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 47/99] qemu-img: Fix assert when mapping unaligned raw file,
Michael Roth <=
- [Qemu-stable] [PATCH 49/99] arm_gicv3_kvm: kvm_dist_get/put_priority: skip the registers banked by GICR_IPRIORITYR, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 48/99] iotests: Add test 221 to catch qemu-img map regression, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 50/99] usb: correctly handle Zero Length Packets, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 04/99] nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 51/99] usb/dev-mtp: Fix use of uninitialized values, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 52/99] vnc: fix use-after-free, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 55/99] nbd/client: fix nbd_negotiate_simple_meta_context, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 54/99] cpus: tcg: fix never exiting loop on unplug, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 53/99] block/mirror: honor ratelimit again, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 56/99] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits, Michael Roth, 2018/07/23