From 35588fd6885c9bf6670f2e899324a4b359baa3c0 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Apr 20 2009 13:51:35 +0000 Subject: - Fix qcow2 image corruption (#496642) --- diff --git a/qemu-fix-qcow2-corruption.patch b/qemu-fix-qcow2-corruption.patch new file mode 100644 index 0000000..95a3a6d --- /dev/null +++ b/qemu-fix-qcow2-corruption.patch @@ -0,0 +1,36 @@ +From: Kevin Wolf +To: qemu-devel@nongnu.org +Subject: [Qemu-devel] [PATCH] qcow2 corruption: Fix alloc_cluster_link_l2 + +This patch fixes a qcow2 corruption bug introduced in SVN Rev 5861. L2 tables +are big endian, so entries must be converted before being passed to functions. + +This bug is easy to trigger. The following script will create and destroy a +qcow2 image (the header is gone after three loop iterations): + + #!/bin/bash + qemu-img create -f qcow2 test.qcow 1M + for i in $(seq 1 10); do + qemu-system-x86_64 -hda test.qcow -monitor stdio > /dev/null 2>&1 < +--- + block-qcow2.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff -up qemu-kvm-0.10/qemu/block-qcow2.c.qcow2-corruption qemu-kvm-0.10/qemu/block-qcow2.c +--- qemu-kvm-0.10/qemu/block-qcow2.c.qcow2-corruption 2009-04-20 14:41:22.000000000 +0100 ++++ qemu-kvm-0.10/qemu/block-qcow2.c 2009-04-20 14:41:54.000000000 +0100 +@@ -912,7 +912,7 @@ static int alloc_cluster_link_l2(BlockDr + goto err; + + for (i = 0; i < j; i++) +- free_any_clusters(bs, old_cluster[i], 1); ++ free_any_clusters(bs, be64_to_cpu(old_cluster[i]), 1); + + ret = 0; + err: diff --git a/qemu.spec b/qemu.spec index bbeecfd..d0c7fe2 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,7 +1,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 0.10 -Release: 10%{?dist} +Release: 11%{?dist} # I have mistakenly thought the revision name would be 1.0. # So 0.10 series get Epoch = 1 Epoch: 2 @@ -38,6 +38,7 @@ Patch13: qemu-roms-more-room-fix-vga-align.patch Patch14: qemu-bios-bigger-roms.patch Patch15: qemu-fix-display-breakage.patch Patch16: qemu-fix-qcow2-2TB.patch +Patch17: qemu-fix-qcow2-corruption.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel @@ -224,6 +225,7 @@ such as kvmtrace and kvm_stat. %patch14 -p1 %patch15 -p1 %patch16 -p1 +%patch17 -p1 %build # systems like rhel build system does not have a recent enough linker so @@ -465,6 +467,9 @@ fi %{_mandir}/man1/qemu-img.1* %changelog +* Mon Apr 20 2009 Mark McLoughlin - 2:0.10-11 +- Fix qcow2 image corruption (#496642) + * Sun Apr 19 2009 Mark McLoughlin - 2:0.10-10 - Run sysconfig.modules from %post on x86_64 too (#494739)