qemu-patch-raspberry4/block
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
..
blkdebug.c
blkverify.c
bochs.c
cloop.c
commit.c
cow.c
curl.c
dmg.c
gluster.c
iscsi.c
linux-aio.c
Makefile.objs
mirror.c
nbd.c
parallels.c
qcow.c
qcow2-cache.c
qcow2-cluster.c qcow2: Catch some L1 table index overflows 2013-05-14 16:44:33 +02:00
qcow2-refcount.c
qcow2-snapshot.c
qcow2.c qcow2: Catch some L1 table index overflows 2013-05-14 16:44:33 +02:00
qcow2.h qcow2: Catch some L1 table index overflows 2013-05-14 16:44:33 +02:00
qed-check.c
qed-cluster.c
qed-gencb.c
qed-l2-cache.c
qed-table.c
qed.c
qed.h
raw-aio.h
raw-posix.c
raw-win32.c
raw.c
rbd.c
sheepdog.c
ssh.c
stream.c
vdi.c
vhdx.c
vhdx.h
vmdk.c
vpc.c
vvfat.c
win32-aio.c