[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-4.0 v3 0/6] NBD server alignment improvement
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH for-4.0 v3 0/6] NBD server alignment improvement |
Date: |
Fri, 29 Mar 2019 17:45:33 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 |
On 3/29/19 3:30 PM, Eric Blake wrote:
>> ... yet the 2^63-512 image can be opened (same as before):
>>
>> $ ./nbdkit -U - memory size=$((2**63 - 512)) --run 'qemu-img info $nbd'
>> image: nbd+unix://?socket=/tmp/nbdkitHSAzNz/socket
>> file format: raw
>> virtual size: -8388607T (9223372036854775296 bytes)
>> disk size: unavailable
>>
>> I've just noticed that the virtual size negative (also in upstream
>> qemu). That looks like a bug too ...
>
> Yes, it does. I'll see if I can find a quick fix for that formatting
> routine.
>
qemu-img is calling block/qapi.c:get_human_readable_size(), which stops
at T, and has indeed has some horrible overflow problems, such as:
((size + (base >> 1)) / base),
without regards to whether int64_t size is near maximum before the addition.
Other places in the code base use util/cutils.c:size_to_str(), which
handles all the way up to E, and appears to be a bit saner.
Why we have to separate integer-to-human converters, where one is rather
buggy, is beyond me.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 4/6] nbd/client: Support qemu-img convert from unaligned size, (continued)
- [Qemu-devel] [PATCH v3 3/6] nbd/client: Report offsets in bdrv_block_status, Eric Blake, 2019/03/29
- [Qemu-devel] [PATCH v3 2/6] nbd/client: Lower min_block for block-status, unaligned size, Eric Blake, 2019/03/29
- Re: [Qemu-devel] [PATCH for-4.0 v3 0/6] NBD server alignment improvement, Richard W.M. Jones, 2019/03/29
- [Qemu-devel] [PATCH v3 7/6] nbd/client: Ignore inaccessible tail of inconsistent server, Eric Blake, 2019/03/29
- [Qemu-devel] [PATCH v3.1 3.5/6] nbd/client: Reject inaccessible tail of inconsistent server, Eric Blake, 2019/03/30
- [Qemu-devel] [PATCH v3 6.5/6] nbd/client: Trace server noncompliance on structured reads, Eric Blake, 2019/03/30