[libvirt] [PATCH v2] PanicCheckABIStability: Need to check for existence

John Ferlan jferlan at redhat.com
Sat Dec 21 12:22:49 UTC 2013


Commit id '4313fead' added a call to virDomainPanicCheckABIStability()
which did not check whether the panic device existed before making a call
to virDomainDeviceInfoCheckABIStability() which ended up segfaulting:

Thread 1 (Thread 0x7f5332837700 (LWP 10964)):
    (src=<optimized out>, dst=<optimized out>)
    at conf/domain_conf.c:13007
    (dst=<optimized out>, src=<optimized out>)
    at conf/domain_conf.c:13712
    (src=<optimized out>, dst=<optimized out>)
    at conf/domain_conf.c:14056
    (domain=domain at entry=0x7f53000057c0, vm=vm at entry=0x7f53000036d0,
     defptr=defptr at entry=0x7f5332836978, snap=snap at entry=0x7f5332836970,
     update_current=update_current at entry=0x7f5332836962, flags=flags at entry=1)
    at conf/snapshot_conf.c:1230
    (domain=0x7f53000057c0, xmlDesc=<optimized out>, flags=1)
    at qemu/qemu_driver.c:12719
    (domain=domain at entry=0x7f53000057c0, xmlDesc=0x7f53000081d0
     "<domainsnapshot>\n  <name>snap2</name>\n
     <description>new-desc</description>\n  <state>running</state>\n
     <parent>\n    <name>snap1</name>\n  </parent>\n
     <creationTime>1387487268</creationTime>\n  <memory s"..., flags=1)
    at libvirt.c:19695
...

(gdb) up 3
(gdb) print *other->def->dom
$2 = {virtType = 2, id = -1, ..
...
  rng = 0x0, panic = 0x0, namespaceData = 0x0,...
...
(gdb) print *def->dom
$3 = {virtType = 2, id = -1, ...
...
  rng = 0x0, panic = 0x0, namespaceData = 0x0,...
...
(gdb)

Also seen using following sequence:

virsh save $dom $file
virsh save-image-edit $file
  add (or remove) a <panic/> line
  <devices>
  ...
    <panic>
      <address type='isa' iobase='0x505'/>
    </panic>
  ...
  </devices>

Signed-off-by: John Ferlan <jferlan at redhat.com>
---

Changes since v1 -
   Added !src && !dst check, which results in:

 error: unsupported configuration: Target domain panic device count '0' does not match source count '1'

 src/conf/domain_conf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0079234..773c29d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13709,6 +13709,17 @@ static bool
 virDomainPanicCheckABIStability(virDomainPanicDefPtr src,
                                 virDomainPanicDefPtr dst)
 {
+    if (!src && !dst)
+        return true;
+
+    if (!src || !dst) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain panic device count '%d' "
+                         "does not match source count '%d'"),
+                       src ? 1 : 0, dst ? 1 : 0);
+        return false;
+    }
+
     return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
 }
 
-- 
1.8.3.1




More information about the libvir-list mailing list