Bug 604210 - Segmentation fault when check preallocated qcow2 image on lvm.
Segmentation fault when check preallocated qcow2 image on lvm.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Kevin Wolf
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-15 11:50 EDT by lihuang
Modified: 2013-01-09 17:44 EST (History)
6 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.82.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-03 14:55:14 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 lihuang 2010-06-15 11:50:57 EDT
Description of problem:
the lvm is 2g. 

[root@t70 qemu-kvm-0.12.1.2]# lvs
  LV      VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
...
  lvtest  vgtest -wi-a-   2.00g                                      

the qcow2 is created as 20G 
qemu-img create -f qcow2 -o preallocation=metadata /dev/vgtest/lvtest 20G

run qemu-img check on the image got the crash.

ERROR: invalid cluster offset=0x1100010000000000

Core was generated by `qemu-img check -f qcow2 /dev/vgtest/lvtest'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000041f3aa in qcow2_check_refcounts (bs=0x1f662e0)
    at block/qcow2-refcount.c:1098
1098                if (refcount_table[offset / s->cluster_size] != 1) {
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.2.el6.x86_64 libaio-0.3.107-10.el6.x86_64 zlib-1.2.3-24.el6.x86_64
(gdb) bt
#0  0x000000000041f3aa in qcow2_check_refcounts (bs=0x1f662e0)
    at block/qcow2-refcount.c:1098
#1  0x0000000000403bf1 in img_check (argc=<value optimized out>, 
    argv=<value optimized out>) at qemu-img.c:420
#2  0x00000031d641ec5d in __libc_start_main () from /lib64/libc.so.6
#3  0x0000000000402d09 in _start ()



Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.74.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 2 RHEL Product and Program Management 2010-06-15 12:13:14 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 3 Yaniv Kaul 2010-06-22 05:51:03 EDT
(In reply to comment #0)
> Description of problem:
> the lvm is 2g. 
> 
> [root@t70 qemu-kvm-0.12.1.2]# lvs
>   LV      VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
> ...
>   lvtest  vgtest -wi-a-   2.00g                                      
> 
> the qcow2 is created as 20G 
> qemu-img create -f qcow2 -o preallocation=metadata /dev/vgtest/lvtest 20G
> 
> run qemu-img check on the image got the crash.
> 
> ERROR: invalid cluster offset=0x1100010000000000
> 
> Core was generated by `qemu-img check -f qcow2 /dev/vgtest/lvtest'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x000000000041f3aa in qcow2_check_refcounts (bs=0x1f662e0)
>     at block/qcow2-refcount.c:1098
> 1098                if (refcount_table[offset / s->cluster_size] != 1) {
> Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.2.el6.x86_64
> libaio-0.3.107-10.el6.x86_64 zlib-1.2.3-24.el6.x86_64

Why not install the above and provide a better backtrace?

> (gdb) bt
> #0  0x000000000041f3aa in qcow2_check_refcounts (bs=0x1f662e0)
>     at block/qcow2-refcount.c:1098

A bit of check on the value of s->cluster_size and possibly the other variables in line 1098 would have produced a much better bug report.

> #1  0x0000000000403bf1 in img_check (argc=<value optimized out>, 
>     argv=<value optimized out>) at qemu-img.c:420
> #2  0x00000031d641ec5d in __libc_start_main () from /lib64/libc.so.6
> #3  0x0000000000402d09 in _start ()
>
Comment 8 lihuang 2010-07-03 14:54:56 EDT
Tested on qemu-kvm-0.12.1.2-2.82.el6.

1. qemu-img reporting right error message wheh checking the faulty image (lv) in #c0

qemu-img check -f qcow2 /dev/vgtest/lvtest  
ERROR refcount block 8191 is outside image
1 errors were found on the image.


2. can not create image when offset is outside image .
[root@t70 82]# lvs
  LV      VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lvtest  vgtest -wi-a-   2.00g                                      

[root@t70 82]# qemu-img create -f qcow2 -o preallocation=metadata /dev/vgtest/lvtest 2G
Formatting '/dev/vgtest/lvtest', fmt=qcow2 size=10737418240 encryption=off cluster_size=0 preallocation='metadata' 
qemu-img: /dev/vgtest/lvtest: error while creating qcow2: Input/output error
Comment 9 lihuang 2010-07-03 15:01:10 EDT
(In reply to comment #8)
> Tested on qemu-kvm-0.12.1.2-2.82.el6.
> 
> 1. qemu-img reporting right error message wheh checking the faulty image (lv)
> in #c0
> 
> qemu-img check -f qcow2 /dev/vgtest/lvtest  
> ERROR refcount block 8191 is outside image
> 1 errors were found on the image.
> 
> 
> 2. can not create image when offset is outside image .
> [root@t70 82]# lvs
>   LV      VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
>   lvtest  vgtest -wi-a-   2.00g                                      
> 
> [root@t70 82]# qemu-img create -f qcow2 -o preallocation=metadata
> /dev/vgtest/lvtest 2G
> Formatting '/dev/vgtest/lvtest', fmt=qcow2 size=10737418240 encryption=off
> cluster_size=0 preallocation='metadata' 
> qemu-img: /dev/vgtest/lvtest: error while creating qcow2: Input/output error    

3. create qcow2 without preallocation. full installation RHEL5.5 guest on with the image. run qemu-img check when the guest is PAUSED on enospc error. 
   --> there is some harmless warnning. but no segfault.

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