Received: from [140.186.70.92] (port=32798 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQ3Vy-00006N-OL for qemu-devel@nongnu.org; Sat, 19 Jun 2010 15:15:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQ3Vw-0007or-Pv for qemu-devel@nongnu.org; Sat, 19 Jun 2010 15:15:38 -0400 Received: from adelie.canonical.com ([91.189.90.139]:33565) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQ3Vw-0007oc-GS for qemu-devel@nongnu.org; Sat, 19 Jun 2010 15:15:36 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OQ3Vu-0000Ph-SN for ; Sat, 19 Jun 2010 20:15:35 +0100 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id D38642E8221 for ; Sat, 19 Jun 2010 20:15:33 +0100 (BST) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Sat, 19 Jun 2010 19:06:29 -0000 From: Anthony Liguori Sender: bounces@canonical.com References: <20100602160905.25995.39284.malonedeb@palladium.canonical.com> Message-Id: <20100619190632.24319.48869.launchpad@palladium.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 588803] Re: Image corruption during snapshot creation/deletion Reply-To: Bug 588803 <588803@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ** Visibility changed to: Public ** This bug is no longer flagged as a security vulnerability -- = Image corruption during snapshot creation/deletion https://bugs.launchpad.net/bugs/588803 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: Incomplete Bug description: Hello, The creation/deletion of snapshots sometimes crashes and corrupts the VM im= age and provoke a segmentation fault in "strcmp", called from "bdrv_snapsho= t_find". Here is a patch that temporarily fixes that (it fixes the segfault but not = its reason) : --- qemu-kvm-0.12.2-old/savevm.c 2010-01-18 19:48:25.000000000 +0100 +++ qemu-kvm-0.12.2/savevm.c 2010-02-12 13:45:07.225644169 +0100 @@ -1624,6 +1624,7 @@ int nb_sns, i, ret; = ret =3D -ENOENT; + if (!name) return ret; nb_sns =3D bdrv_snapshot_list(bs, &sn_tab); if (nb_sns < 0) return ret; @@ -1649,6 +1650,8 @@ QEMUSnapshotInfo sn1, *snapshot =3D &sn1; int ret; = + if (!name) return 0; + QTAILQ_FOREACH(dinfo, &drives, next) { bs =3D dinfo->bdrv; if (bdrv_can_snapshot(bs) && @@ -1777,6 +1780,11 @@ QTAILQ_FOREACH(dinfo, &drives, next) { bs1 =3D dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { + if (!name) { + monitor_printf(mon, "Could not find snapshot 'NULL' on " + "device '%s'\n", + bdrv_get_device_name(bs1)); + } ret =3D bdrv_snapshot_goto(bs1, name); if (ret < 0) { if (bs !=3D bs1) @@ -1804,6 +1812,11 @@ } } = + if (!name) { + monitor_printf(mon, "VM state name is NULL\n"); + return -EINVAL; + } + /* Don't even try to load empty VM states */ ret =3D bdrv_snapshot_find(bs, &sn, name); if ((ret >=3D 0) && (sn.vm_state_size =3D=3D 0)) @@ -1840,6 +1853,11 @@ QTAILQ_FOREACH(dinfo, &drives, next) { bs1 =3D dinfo->bdrv; if (bdrv_has_snapshot(bs1)) { + if (!name) { + monitor_printf(mon, "Could not find snapshot 'NULL' on " + "device '%s'\n", + bdrv_get_device_name(bs1)); + } ret =3D bdrv_snapshot_delete(bs1, name); if (ret < 0) { if (ret =3D=3D -ENOTSUP) The patch is very simple. Some checks on the variable "name" were missing i= n "savevm.c". Regards, Nicolas Grandjean Conix Security