Simple reproducer using only qemu tools:

$ 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

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/865518

Title:
  qemu segfaults when writing to very large qcow2 disk

Status in QEMU:
  New

Bug description:
  Create a ridiculously large qcow2 disk:

  qemu-img create -f qcow2 test1.img $((2**63-513))

  Attach it to a guest and try to use parted to partition it.  This is
  easy with virt-rescue: you just do:

  virt-rescue test1.img
  ><rescue> parted /dev/vda mklabel gpt
  <-- bang! qemu segfaults here

  The stack trace is:

  Program received signal SIGSEGV, Segmentation fault.
  0x0000000000434cac in get_cluster_table (bs=0x3193030, offset=
      9223372036854764544, new_l2_table=0x591e3c8, new_l2_offset=0x591e3c0, 
      new_l2_index=0x591e408) at block/qcow2-cluster.c:506
  506       l2_offset = s->l1_table[l1_index];
  (gdb) bt
  #0  0x0000000000434cac in get_cluster_table (bs=0x3193030, offset=
      9223372036854764544, new_l2_table=0x591e3c8, new_l2_offset=0x591e3c0, 
      new_l2_index=0x591e408) at block/qcow2-cluster.c:506
  #1  0x000000000043535b in qcow2_alloc_cluster_offset (bs=0x3193030, offset=
      9223372036854764544, n_start=106, n_end=126, num=0x591e4e8, m=0x591e470)
      at block/qcow2-cluster.c:719
  #2  0x000000000043b8d4 in qcow2_co_writev (bs=0x3193030, sector_num=
      18014398509481962, remaining_sectors=20, qiov=0x4a81ee0)
      at block/qcow2.c:554
  #3  0x0000000000428691 in bdrv_co_rw (opaque=0x38bad10) at block.c:2781
  #4  0x000000000046e03a in coroutine_trampoline (i0=59487248, i1=0)
      at coroutine-ucontext.c:125
  #5  0x00000034dc6471b0 in ?? () from /lib64/libc.so.6
  #6  0x00007fff76cbb430 in ?? ()
  #7  0x0000000000000000 in ?? ()

  This is qemu from git (8f440cda08c6df574 from 2011-09-29)

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/865518/+subscriptions

Reply via email to