From 4b48ba4af5eb0efd60bb53558dcc27ae86415b32 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 26 Jun 2015 10:59:33 +0200 Subject: [PATCH] conf: qemu: Taint VMs using custom device tree blob 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 ad641ed67b..006e04effc 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 aeba5a50a6..2bdbff1e14 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 404489c9c9..f9bf32c61d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2117,6 +2117,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.47.2