[libvirt] Segfault in virDomainObjListSearchName when listing domains (qemu backend)

Guido Winkelmann guido-libvi at unknownsite.de
Mon Jun 28 17:29:43 UTC 2010


Am Montag, 28. Juni 2010 schrieben Sie:
> On Mon, Jun 28, 2010 at 06:06:00PM +0200, Guido Winkelmann wrote:
> > Another segfault, again after calling list in virsh after a domain failed
> > to start:
> 
> I haven't reproduced the crashes, but try this patch which I think might
> solve one possible flaw.
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 6ae4e8c..26d935a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -1178,9 +1178,10 @@ static void qemuHandleMonitorDestroy(qemuMonitorPtr
>  mon, virDomainObjPtr vm)
>  {
>      qemuDomainObjPrivatePtr priv = vm->privateData;
> -    if (priv->mon == mon)
> +    if (mon && (priv->mon == mon)) {
>          priv->mon = NULL;
> -    virDomainObjUnref(vm);
> +        virDomainObjUnref(vm);
> +    }
>  }
> 
>  static qemuMonitorCallbacks monitorCallbacks = {
> @@ -1212,6 +1213,8 @@ qemuConnectMonitor(struct qemud_driver *driver,
>  virDomainObjPtr vm) * deleted while the monitor is active */
>      virDomainObjRef(vm);
> 
> +    priv->mon = NULL; /* Explicitly nullify it so destroy callback sees
>  NULL +                       * if it is invoked during construction */
>      priv->mon = qemuMonitorOpen(vm,
>                                  priv->monConfig,
>                                  priv->monJSON,

Looks good so far. There's is still a problem with domains just not starting 
up (somtimes / most of the time) if the host host is under some load, but at 
least it doesn't seem crash from a simple list --all in virsh anymore.

	Guido




More information about the libvir-list mailing list