qcow2 corruption

Bug #361938 reported by Dustin Kirkland 
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kvm (Ubuntu)
Fix Released
Critical
Dustin Kirkland 
Jaunty
Fix Released
Critical
Dustin Kirkland 

Bug Description

Binary package hint: kvm

A serious qcow2 corruption issue was fixed upstream. We should proactively carry this patch in Ubuntu.

:-Dustin

Related branches

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

http://git.kernel.org/?p=virt/kvm/kvm-userspace.git;a=commitdiff;h=385aae33c08e17ec63671b9fa1c503c21283bc1f;hp=b335c2b5762259c827bae487dca26441497a96cb

qcow2's get_cluster_offset() scans forward in the l2 table to find other
clusters that have the same allocation status as the first cluster.
This is used by (among others) qcow_is_allocated().

Unfortunately, it was not checking to be sure that it didn't fall off
the end of the l2 table. This patch adds that check.

The symptom that motivated me to look into this was that
bdrv_is_allocated() was returning false when there was in fact data
there. This is one of many ways this bug could lead to data corruption.

I checked the other place that scans for consecutive unallocated blocks
(alloc_cluster_offset()) and it appears to be OK:
    nb_clusters = MIN(nb_clusters, s->l2_size - l2_index);
appears to prevent the same problem from occurring.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <email address hidden>

Changed in kvm (Ubuntu):
assignee: nobody → Dustin Kirkland (kirkland)
importance: Undecided → Critical
status: New → In Progress
Changed in kvm (Ubuntu Jaunty):
milestone: none → ubuntu-9.04
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kvm - 1:84+dfsg-0ubuntu11

---------------
kvm (1:84+dfsg-0ubuntu11) jaunty; urgency=low

  * debian/patches/add-all-virtio-drives.patch: Fix bugs where the caller
    does not specify a perfectly defined list of virtio drives starting at
    index=0 and having no gaps in indices; LP: #360832, #360825
  * debian/patches/fix-qcow-corruption: Cherry-pick from kvm stable git
    branch, fixes at least one cause of qcow2 image corruption; no reports
    yet of this in Ubuntu, but I'm being proactive about this one;
    LP: #361938
  * debian/source_kvm.py: dpkg -l was a little too heavy, compress this
    output considerably

 -- Dustin Kirkland <email address hidden> Fri, 17 Apr 2009 09:59:58 -0500

Changed in kvm (Ubuntu Jaunty):
status: In Progress → Fix Released
Revision history for this message
Jamie Lokier (jamie-shareable) wrote :

I was the original submitter of the "qcow2 corruption observed, fixed by reverting old change" thread on the <email address hidden> list, after finding corruption when testing kvm-83.

I've just submitted an update to the qemu and kvm lists, saying that the symptom I observed (a blue screen while booting some image) seems to be fixed in kvm-85, but not kvm-84.

I'm not sure if the kvm-84 to kvm-85 qcow2 fix is in the latest Ubuntu kvm package, kvm-1:84+dfsg-0ubuntu11 indicated by the previous comment.

If it is, that's great. But if the latest package only includes code equivalent to upstream's kvm-84, there's an important qcow2 corruption fix which should still be included.

Also, I see from release notes for the later upstream kvm versions that there are further qcow2 corruption fixes in later versions. You may wish to incorporate those too, I don't know.

Revision history for this message
Jamie Lokier (jamie-shareable) wrote :

See also bug #404394, which suggests there are still qcow2 bugs in the Ubuntu package.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.