RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1004347 - Backport qcow2 corruption prevention patches
Summary: Backport qcow2 corruption prevention patches
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Hanna Czenczek
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1004420
TreeView+ depends on / blocked
 
Reported: 2013-09-04 13:03 UTC by Kevin Wolf
Modified: 2014-06-18 03:37 UTC (History)
11 users (show)

Fixed In Version: qemu-kvm-1.5.3-34.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1004420 (view as bug list)
Environment:
Last Closed: 2014-06-13 10:08:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Kevin Wolf 2013-09-04 13:03:17 UTC
Upstream commits d4ca092a to ca0eca91 implements sanity checks for writes to a
qcow2 image as follows:

> If a qcow2 image file becomes corrupted, any write may inadvertently
> overwrite important metadata structures such as the L1 table. This
> series adds functionality for detecting, preventing and (to some extent)
> repairing such collisions.

This is something that we'll want to have in RHEL 7.

Comment 1 Miroslav Rezanina 2013-11-07 14:24:58 UTC
Fix included in qemu-kvm-1.5.3-16.el7

Comment 4 huiqingding 2013-12-23 06:30:26 UTC
Hi Max, 

Would you please answer the question of comment #3 ?

Best regards
Huiqing

Comment 6 juzhang 2014-01-03 09:17:25 UTC
Hi Huding,

Could you have a look and update the result in the bz?

Best Regards,
Junyi

Comment 9 Miroslav Rezanina 2014-01-08 12:43:46 UTC
Fix included in qemu-kvm-1.5.3-34.el7

Comment 10 huiqingding 2014-01-13 09:22:11 UTC
Reproduce this bug using the following version:
qemu-kvm-1.5.3-15.el7.x86_64
kernel-3.10.0-64.el7.x86_64

Run test 060 of qemu-iotests and the result is as following:
# ./check -qcow2 060
QEMU          -- /usr/libexec/qemu-kvm
QEMU_IMG      -- /usr/bin/qemu-img
QEMU_IO       -- /usr/bin/qemu-io 
IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- Linux/x86_64 dhcp-8-151 3.10.0-64.el7.x86_64

060 1s ... - output mismatch (see 060.out.bad)
--- 060.out	2014-01-13 11:34:39.458489446 +0800
+++ 060.out.bad	2014-01-13 17:18:26.944998958 +0800
@@ -8,10 +8,13 @@
 1 errors were found on the image.
 Data may be corrupted, or further writes to the image may corrupt it.
 incompatible_features     0x0
-qcow2: Preventing invalid write on metadata (overlaps with active L1 table); image marked as corrupt.
-write failed: Input/output error
-incompatible_features     0x2
-qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; cannot be opened read/write
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
+incompatible_features     0x0
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -24,58 +27,55 @@
 2 errors were found on the image.
 Data may be corrupted, or further writes to the image may corrupt it.
 incompatible_features     0x0
-qcow2: Preventing invalid write on metadata (overlaps with refcount block); image marked as corrupt.
-write failed: Input/output error
-incompatible_features     0x2
-Repairing refcount block 0 refcount=2
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
+incompatible_features     0x0
+ERROR refcount block 0 refcount=2
+Repairing cluster 2 refcount=1 reference=2
+ERROR OFLAG_COPIED: offset=8000000000020000 refcount=2
+ERROR refcount block 0 refcount=2
 The following inconsistencies were found and repaired:
 
     0 leaked clusters
     1 corruptions
 
 Double checking the fixed image now...
-No errors were found on the image.
+
+2 errors were found on the image.
+Data may be corrupted, or further writes to the image may corrupt it.
 incompatible_features     0x0
-wrote 512/512 bytes at offset 0
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
 incompatible_features     0x0
 
 === Testing cluster data reference into inactive L2 table ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 
-wrote 512/512 bytes at offset 0
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 512/512 bytes at offset 0
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-ERROR cluster 4 refcount=1 reference=2
-Leaked cluster 9 refcount=1 reference=0
-
-1 errors were found on the image.
-Data may be corrupted, or further writes to the image may corrupt it.
-
-1 leaked clusters were found on the image.
-This means waste of disk space, but no harm to data.
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
+No errors were found on the image.
+incompatible_features     0x0
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
 incompatible_features     0x0
-qcow2: Preventing invalid write on metadata (overlaps with inactive L2 table); image marked as corrupt.
-write failed: Input/output error
-incompatible_features     0x2
-Repairing cluster 4 refcount=1 reference=2
-Repairing cluster 9 refcount=1 reference=0
-Repairing OFLAG_COPIED data cluster: l2_entry=8000000000040000 refcount=2
-The following inconsistencies were found and repaired:
-
-    1 leaked clusters
-    2 corruptions
-
-Double checking the fixed image now...
 No errors were found on the image.
 incompatible_features     0x0
-wrote 512/512 bytes at offset 0
-512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+open: invalid option -- 'o'
+no file open, try 'help open'
+open [-Crsn] [path] -- open the file specified by path
 incompatible_features     0x0
+Pattern verification failed at offset 0, 512 bytes
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 No errors were found on the image.
+Pattern verification failed at offset 0, 512 bytes
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 *** done
Failures: 060
Failed 1 of 1 tests

Comment 11 huiqingding 2014-01-13 09:25:37 UTC
Reproduce this bug using the following version:
qemu-kvm-1.5.3-35.el7.x86_64
kernel-3.10.0-64.el7.x86_64

Run test 060 of qemu-iotests and the result is as following:
# ./check -qcow2 060
QEMU          -- /usr/libexec/qemu-kvm
QEMU_IMG      -- /usr/bin/qemu-img
QEMU_IO       -- /usr/bin/qemu-io 
IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- Linux/x86_64 dhcp-8-151 3.10.0-64.el7.x86_64

060 1s ...
Passed all 1 tests

Based on the above result, I think this bug is fixed.

Comment 12 huiqingding 2014-01-21 03:21:22 UTC
(In reply to huiqingding from comment #11)
> Reproduce this bug using the following version:

Sorry, it should "Verify this bug using the following version"

> qemu-kvm-1.5.3-35.el7.x86_64
> kernel-3.10.0-64.el7.x86_64
> 
> Run test 060 of qemu-iotests and the result is as following:
> # ./check -qcow2 060
> QEMU          -- /usr/libexec/qemu-kvm
> QEMU_IMG      -- /usr/bin/qemu-img
> QEMU_IO       -- /usr/bin/qemu-io 
> IMGFMT        -- qcow2 (compat=1.1)
> IMGPROTO      -- file
> PLATFORM      -- Linux/x86_64 dhcp-8-151 3.10.0-64.el7.x86_64
> 
> 060 1s ...
> Passed all 1 tests
> 
> Based on the above result, I think this bug is fixed.

Comment 14 Ludek Smid 2014-06-13 10:08:46 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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