Bug 491981 - Integer wraparound creating a large disk image in VPC format
Integer wraparound creating a large disk image in VPC format
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Glauber Costa
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-24 16:05 EDT by Daniel Berrange
Modified: 2009-05-19 20:53 EDT (History)
6 users (show)

See Also:
Fixed In Version: 0.10.4-4.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-04-19 10:43:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2009-03-24 16:05:40 EDT
Description of problem:
Try and create a 5 TB disk image

# qemu-img create -f vpc foo.cow 5000G
Formatting 'foo.cow', fmt=vpc, size=5242880000 kB

...you don't get a 5 TB image out the other side

# qemu-img info foo.cow 
image: foo.cow
file format: vpc
virtual size: 127G (136899993600 bytes)
disk size: 264K

At least qemu-img doesn't SEGV though, so its better than qcow2 :-)

Version-Release number of selected component (if applicable):
qemu-0.10-0.9.kvm20090310git.fc11.x86_64

How reproducible:
Always

Steps to Reproduce:
1.qemu-img create -f vpc foo.cow 5000G
2.
3.
  
Actual results:
127G disk image

Expected results:
5 TB disk image

Additional info:
Comment 1 Glauber Costa 2009-04-01 13:49:40 EDT
Does chris' patch in the qcow2 bz fixes this too?
Comment 2 Daniel Berrange 2009-04-01 14:22:10 EDT
I can't see how Chris' patch would help, since its against block-qcow2.c not  block-vpc.c  :-)
Comment 3 Kevin Wolf 2009-04-02 11:14:44 EDT
This is not a wraparound but the maximum value supported by the CHS calculation algorithm in the VHD specification - and I tried to stay close to the spec when implementing VHD write support.

Is it even possible to create that large images with Virtual PC? If so, qemu-img should behave the same, even if this means deviating from the spec.
Comment 4 Daniel Berrange 2009-04-02 11:24:57 EDT
I'm not sure if Virtual PC / VHD spec allows for disks this big - I was just trying to confuse qemu-img code and see what happened :-)

If we can't support 5 TB disks, then I'm happy for qemu-img to explicitly refuse to create this disk, and give an error message back telling the user their requested disk size is too large.
Comment 5 Kevin Wolf 2009-04-02 11:47:41 EDT
I would really like to know what Virtual PC does. Do you have a Windows machine or VM by any chance where you could try this? Currently I don't have the hardware yet to do that myself.

If Virtual PC behaviour matches the spec and the limitation is going to stay, I agree that an error message is a better solution than silently creating a smaller image.
Comment 6 Michael Kartoz 2009-04-10 03:19:19 EDT
Running Virtual PC 2007 SP1 on Vista x64, and creating a "dynamically expanding" virtual hard disk, Virtual PC states that the maximum virtual hard disk size is "130,557 MB".  I tried entering 500000 MB anyhow and it comes back with a message, "Please enter a size value between 3 MB and 130,557 MB."

Interestingly, when I try to create a "fixed-size" virtual hard disk instead, the maximum claims to be 375,493 MB.  I think that is being limited by the free space on the disk at the time I run the utility since I currently have 366 GB free on that partition.  I don't have a larger partition to play with.
Comment 7 Kevin Wolf 2009-04-14 03:32:13 EDT
Thanks for trying it out. This confirms what I found on the internet. I have already sent a patch to qemu-devel last week which aborts with an error message when you want create too large VHD images. It doesn't seem to be applied yet, though.

Please note that the qemu VPC format is only used for dynamic disks. For fixed size disks you would use the raw driver.
Comment 8 Kevin Wolf 2009-04-15 11:04:59 EDT
The patch has now been applied in upstream qemu as SVN Rev 7109.
Comment 9 Mark McLoughlin 2009-04-19 10:43:53 EDT
Thanks Kevin, closing this as resolved upstream - no particular need to fix this for F11
Comment 10 Fedora Update System 2009-05-13 07:59:15 EDT
qemu-0.10.4-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/qemu-0.10.4-2.fc11
Comment 11 Fedora Update System 2009-05-13 11:07:09 EDT
qemu-0.10.4-3.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/qemu-0.10.4-3.fc11
Comment 12 Fedora Update System 2009-05-14 07:33:53 EDT
qemu-0.10.4-4.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/qemu-0.10.4-4.fc11
Comment 13 Fedora Update System 2009-05-18 23:37:11 EDT
qemu-0.10.4-5.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/qemu-0.10.4-5.fc11
Comment 14 Fedora Update System 2009-05-19 20:52:58 EDT
qemu-0.10.4-4.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.