qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 2cf7cf: qcow2: Catch some L1 table index over


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 2cf7cf: qcow2: Catch some L1 table index overflows
Date: Tue, 14 May 2013 09:30:10 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 2cf7cfa1cde6672b8a35bbed3fbc989f28c05dce
      
https://github.com/qemu/qemu/commit/2cf7cfa1cde6672b8a35bbed3fbc989f28c05dce
  Author: Kevin Wolf <address@hidden>
  Date:   2013-05-14 (Tue, 14 May 2013)

  Changed paths:
    M block/qcow2-cluster.c
    M block/qcow2.c
    M block/qcow2.h

  Log Message:
  -----------
  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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: f3f4d2c09b9cf46903ba38425ec46c44185162bd
      
https://github.com/qemu/qemu/commit/f3f4d2c09b9cf46903ba38425ec46c44185162bd
  Author: Kevin Wolf <address@hidden>
  Date:   2013-05-14 (Tue, 14 May 2013)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: Add hint to -EFBIG error message

The limit of qcow2 files at least depends on the cluster size. If the
image format has a cluster_size option, suggest to increase it.

Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 110db9b48c0a6379fca122801c3ae48e349aa6d4
      
https://github.com/qemu/qemu/commit/110db9b48c0a6379fca122801c3ae48e349aa6d4
  Author: Anthony Liguori <address@hidden>
  Date:   2013-05-14 (Tue, 14 May 2013)

  Changed paths:
    M block.c
    M block/qcow2-cluster.c
    M block/qcow2.c
    M block/qcow2.h

  Log Message:
  -----------
  Merge remote-tracking branch 'stefanha/block' into staging

# By Kevin Wolf
# Via Stefan Hajnoczi
* stefanha/block:
  block: Add hint to -EFBIG error message
  qcow2: Catch some L1 table index overflows

Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>


Compare: https://github.com/qemu/qemu/compare/e7a09b92b707...110db9b48c0a

reply via email to

[Prev in Thread] Current Thread [Next in Thread]