[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] libvirt no longer supports qemu format=host_device



Bug: https://launchpad.net/bugs/665531

The fixes for CVE-2010-2237, CVE-2010-2238 and CVE-2010-2239 broke
format=host_device for the qemu driver. Qemu's host_device is used to
specify raw files that don't have holes, so we need to treat <driver
name='qemu' type='host_device'/> as raw in virDomainDiskDefForeachPath()
(like we do for 'aio'). For example, the following xml is no longer
valid, but should be:

    <disk type='file' device='disk'>
      <driver name='qemu' type='host_device'/>
      <source file='/tmp/foo.img'/>
      <target dev='hda' bus='ide'/>
    </disk>

This is confirmed as not working on 0.8.3 and 0.8.5. The attached patch
against 0.8.5 fixes the issue and restores host_device support.

-- 
Jamie Strandboge             | http://www.canonical.com
Author: Jamie Strandboge <jamie canonical com>
Description: don't fail with <driver name='qemu' type='host_device'/>
 The fixes for CVE-2010-2237, CVE-2010-2238 and CVE-2010-2239 broke
 format=host_device for the qemu driver. Qemu's host_device is used to specify
 raw files that don't have holes, so we need to treat <driver name='qemu'
 type='host_device'/> as raw in virDomainDiskDefForeachPath() (like we do for
 'aio'). For example, the following xml is no longer valid, but should be:

    <disk type='file' device='disk'>
      <driver name='qemu' type='host_device'/>
      <source file='/tmp/foo.img'/>
      <target dev='hda' bus='ide'/>
    </disk>

 This is confirmed as not working on 0.8.3 and 0.8.5. This patch against 0.8.5
 fixes the issue and restores host_device support.
Bug-Ubuntu: https://launchpad.net/bugs/665531
Forwarded: yes

Index: libvirt-0.8.5/src/conf/domain_conf.c
===================================================================
--- libvirt-0.8.5.orig/src/conf/domain_conf.c	2010-11-05 13:54:59.000000000 -0500
+++ libvirt-0.8.5/src/conf/domain_conf.c	2010-11-05 13:55:24.000000000 -0500
@@ -7747,6 +7747,15 @@
         if (STREQ(formatStr, "aio"))
             formatStr = "raw"; /* Xen compat */
 
+        /* Qemu's host_device is used to specify raw files that don't have
+         * holes, so we need to treat <driver name='qemu' type='host_device'/>
+         * as raw here.
+         */
+        if (disk->driverName &&
+            STREQ(disk->driverName, "qemu") &&
+            STREQ(formatStr, "host_device"))
+            formatStr = "raw";
+
         if ((format = virStorageFileFormatTypeFromString(formatStr)) < 0) {
             virDomainReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("unknown disk format '%s' for %s"),

Attachment: signature.asc
Description: This is a digitally signed message part


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]