Kevin Wolf 2cf7cfa1cd qcow2: Catch some L1 table index overflows
This catches the situation that is described in the bug report at
https://bugs.launchpad.net/qemu/+bug/865518 and goes like this:

    $ qemu-img create -f qcow2 huge.qcow2 $((1024*1024))T
    Formatting 'huge.qcow2', fmt=qcow2 size=1152921504606846976 encryption=off cluster_size=65536 lazy_refcounts=off
    $ qemu-io /tmp/huge.qcow2 -c "write $((1024*1024*1024*1024*1024*1024 - 1024)) 512"
    Segmentation fault

With this patch applied the segfault will be avoided, however the case
will still fail, though gracefully:

    $ qemu-img create -f qcow2 /tmp/huge.qcow2 $((1024*1024))T
    Formatting 'huge.qcow2', fmt=qcow2 size=1152921504606846976 encryption=off cluster_size=65536 lazy_refcounts=off
    qemu-img: The image size is too large for file format 'qcow2'

Note that even long before these overflow checks kick in, you get
insanely high memory usage (up to INT_MAX * sizeof(uint64_t) = 16 GB for
the L1 table), so with somewhat smaller image sizes you'll probably see
qemu aborting for a failed g_malloc().

If you need huge image sizes, you should increase the cluster size to
the maximum of 2 MB in order to get higher limits.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-14 16:44:33 +02:00
2013-05-03 12:04:49 -05:00
2013-05-12 13:25:55 +04:00
2013-05-03 13:53:46 +02:00
2013-05-08 15:28:49 +02:00
2013-05-12 13:25:55 +04:00
2013-05-13 09:52:06 -05:00
2013-05-06 17:22:48 +02:00
2013-05-03 13:58:09 +02:00
2013-05-08 20:23:20 +02:00
2013-05-03 13:58:09 +02:00
2013-05-01 13:04:18 +02:00
2013-04-29 12:16:36 -05:00
2013-05-03 13:58:09 +02:00
2013-05-03 12:04:40 -05:00
2013-05-03 13:05:49 +02:00
2013-05-03 12:04:57 -05:00
2013-05-01 13:06:07 +02:00
2013-05-03 12:04:40 -05:00
2013-05-13 09:52:06 -05:00
2013-05-08 15:54:47 -05:00

Read the documentation in qemu-doc.html or on http://wiki.qemu.org

- QEMU team
Description
No description provided
Readme 404 MiB
Languages
C 82.6%
C++ 6.5%
Python 3.4%
Dylan 2.9%
Shell 1.6%
Other 2.8%