Bug 598488 - qcow2 corruption bug in refcount table growth
qcow2 corruption bug in refcount table growth
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kvm (Show other bugs)
5.5
All Linux
high Severity high
: rc
: ---
Assigned To: Kevin Wolf
Virtualization Bugs
: ZStream
Depends On:
Blocks: 602363
  Show dependency treegraph
 
Reported: 2010-06-01 09:48 EDT by Kevin Wolf
Modified: 2013-01-09 17:39 EST (History)
7 users (show)

See Also:
Fixed In Version: kvm-83-182.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 598407
Environment:
Last Closed: 2011-01-13 18:35:40 EST
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 Kevin Wolf 2010-06-01 09:48:53 EDT
The same bug exists in RHEL 5.5/5.6.

+++ This bug was initially created as a clone of Bug #598407 +++

A bug in rarely used code path in the refcount table growth code of qcow2 can lead to inconsistencies in the metadata, which can cause real data corruption later on.

This bug can be reproduced like this:

[rhel6/master] kwolf@dhcp-5-188:~/source/qemu-kvm-rhel6$ ./qemu-img create -f qcow2 -ocluster_size=512 /tmp/test.qcow2 1G
Formatting '/tmp/test.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=512 
[rhel6/master] kwolf@dhcp-5-188:~/source/qemu-kvm-rhel6$ ./qemu-io /tmp/test.qcow2 
qemu-io> write -b 0 64M
wrote 67108864/67108864 bytes at offset 0
64 MiB, 1 ops; 0:00:11.00 (5.791 MiB/sec and 0.0905 ops/sec)
qemu-io> [rhel6/master] kwolf@dhcp-5-188:~/source/qemu-kvm-rhel6$ ./qemu-img check /tmp/test.qcow2 
ERROR cluster 768 refcount=0 reference=1
ERROR cluster 773 refcount=2 reference=1
ERROR cluster 774 refcount=2 reference=1
ERROR cluster 1024 refcount=0 reference=1
ERROR cluster 1029 refcount=2 reference=1
ERROR cluster 1030 refcount=2 reference=1
ERROR cluster 1031 refcount=2 reference=1
7 errors were found on the image.
Comment 5 Qunfang Zhang 2010-06-10 23:55:13 EDT
Reproduced on kvm-83-181.el5, and verified pass on kvm-83-182.el5

Steps:
1.Create a disk on *RHEL6* host
#qemu-img create -f qcow2 -ocluster_size=512 test.qcow2 1G
2.Copy this disk to RHEL5 host
#/usr/libexec/qemu-kvm test.qcow2 -monitor stdio -vnc :10
(qemu)savevm aaa
(qemu)savevm bbb
(qemu)info snapshots
(qemu)quit
3.#qemu-img check test.qcow2

On kvm-83-181.el5:
[root@dhcp-91-161 home]# qemu-img check test.qcow2 
ERROR cluster 768 refcount=0 reference=1
ERROR cluster 773 refcount=2 reference=1
ERROR cluster 774 refcount=2 reference=1
ERROR cluster 1024 refcount=0 reference=1
ERROR cluster 1029 refcount=2 reference=1
ERROR cluster 1030 refcount=2 reference=1
ERROR cluster 1031 refcount=2 reference=1
ERROR cluster 2304 refcount=0 reference=1
ERROR cluster 2371 refcount=2 reference=1
ERROR cluster 2372 refcount=2 reference=1
ERROR cluster 2560 refcount=0 reference=1
ERROR cluster 2627 refcount=2 reference=1
ERROR cluster 2628 refcount=2 reference=1
ERROR cluster 2629 refcount=2 reference=1
ERROR cluster 4352 refcount=0 reference=1
ERROR cluster 4428 refcount=2 reference=1
ERROR cluster 4429 refcount=2 reference=1
ERROR cluster 4608 refcount=0 reference=1
ERROR cluster 4684 refcount=2 reference=1
ERROR cluster 4685 refcount=2 reference=1
ERROR cluster 4686 refcount=2 reference=1
21 errors were found on the image.

On kvm-83-182.el5
[root@dhcp-91-161 home]# qemu-img check test.qcow2 
No errors were found on the image.
Comment 7 Shirley Zhou 2010-11-02 01:23:11 EDT
Re-verify this bug with package kvm-83-207.el5 as comment 5 steps, after step3, then check image, no error shows.
Change bug to verified.
Comment 9 errata-xmlrpc 2011-01-13 18:35:40 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0028.html

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