[libvirt] [PATCH] conf: qemu: Taint VMs using custom device tree blob

Peter Krempa pkrempa at redhat.com
Fri Jun 26 09:05:59 UTC 2015


Using a custom device tree image may cause unexpected behavior in
architectures that use this approach to detect platform devices. Since
usually the device tree is generated by qemu and thus it's not normally
used let's taint VMs using it to make it obvious as a possible source of
problems.
---
 src/conf/domain_conf.c | 3 ++-
 src/conf/domain_conf.h | 1 +
 src/qemu/qemu_domain.c | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2c3b96b..9280a76 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -102,7 +102,8 @@ VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
               "external-launch",
               "host-cpu",
               "hook-script",
-              "cdrom-passthrough");
+              "cdrom-passthrough",
+              "custom-dtb");

 VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
               "qemu",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index aeba5a5..2bdbff1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2305,6 +2305,7 @@ typedef enum {
     VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use */
     VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
     VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
+    VIR_DOMAIN_TAINT_CUSTOM_DTB,       /* Custom device tree blob was specifed */

     VIR_DOMAIN_TAINT_LAST
 } virDomainTaintFlags;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6213fd9..22ffa83 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2105,6 +2105,9 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
     for (i = 0; i < obj->def->nnets; i++)
         qemuDomainObjCheckNetTaint(driver, obj, obj->def->nets[i], logFD);

+    if (obj->def->os.dtb)
+        qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_CUSTOM_DTB, logFD);
+
     virObjectUnref(cfg);
 }

-- 
2.4.1




More information about the libvir-list mailing list