Bug 598488 - qcow2 corruption bug in refcount table growth
Summary: qcow2 corruption bug in refcount table growth
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kvm
Version: 5.5
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 602363
TreeView+ depends on / blocked
 
Reported: 2010-06-01 13:48 UTC by Kevin Wolf
Modified: 2013-01-09 22:39 UTC (History)
7 users (show)

Fixed In Version: kvm-83-182.el5
Doc Type: Bug Fix
Doc Text:
Clone Of: 598407
Environment:
Last Closed: 2011-01-13 23:35:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0028 0 normal SHIPPED_LIVE Low: kvm security and bug fix update 2011-01-13 11:03:39 UTC

Description Kevin Wolf 2010-06-01 13:48:53 UTC
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-11 03:55:13 UTC
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 05:23:11 UTC
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 23:35:40 UTC
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.