[Libguestfs] [PATCH nbdkit] filters: cache, cow: Handle bitmap overflow on 32 bit architectures.

Eric Blake eblake at redhat.com
Fri Jan 26 14:21:31 UTC 2018


On 01/26/2018 07:53 AM, Eric Blake wrote:
> On 01/26/2018 07:17 AM, Richard W.M. Jones wrote:
>> When compiling on armv7 it becomes clear from the compiler warnings
>> that the current code is wrong.
>>
>> The bitmap has to be allocated in virtual memory, so use size_t to
>> describe the length of the bitmap.  When changing the length of the
>> bitmap, compute the new size as an unsigned 64 bit int, and then check
>> whether or not it is too large to fit into size_t before casting it.
> 
> Indeed, size_t is a sane limit (the only way to get a larger map would
> be using an mmap'd file on disk, so that we can use 64-bit off_t instead
> of 32-bit size_t).

and using a second layer of caching to swap in windows of that file as
needed, as the entire file won't fit in memory at once.  That's a lot of
bookkeeping overhead, for something that is less and less useful as more
people use 64-bit machines.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180126/89a19756/attachment.sig>


More information about the Libguestfs mailing list