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

[libvirt] [PATCH] 528575 avoid libvirtd crash on LCX domain autostart


virsh -c lxc:/// autostart vm1

crash the daemon because the driver autostartDir is never initialized
and we do a NULL dereference. The enclosed patch is trivial and avoid
the crash, but ...

[root paphio ~]# virsh -c lxc:/// dominfo vm1
Id:             -
Name:           vm1
UUID:           d320f760-7541-6633-fd42-4f984fca9f51
OS Type:        exe
State:          shut off
CPU(s):         1
Max memory:     500000 kB
Used memory:    500000 kB
Autostart:      enable

while the domain is properly flagged as autostarting it doesn't seem to
actually autostart, and the driver->autostartDir directory is not
created on the fly as I would expect, i.e. 
still doesn't exist and the domain is marked as off and Autostart: enable

I think it would be good to ACK the patch to avoid the crash but we also
need to have someone look at the autostart of LXC domains and double
check what is going on, maybe I missed something :-)

Ozaki, any chance you could look at this ?


Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index de059bd..74dc367 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -102,6 +102,9 @@ int lxcLoadDriverConfig(lxc_driver_t *driver)
         goto no_memory;
     if ((driver->logDir = strdup(LXC_LOG_DIR)) == NULL)
         goto no_memory;
+    if ((driver->autostartDir = strdup(LXC_AUTOSTART_DIR)) == NULL)
+        goto no_memory;
     if ((filename = strdup(SYSCONF_DIR "/libvirt/lxc.conf")) == NULL)
         goto no_memory;
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index 6e4c855..eca8c7c 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -36,6 +36,7 @@
 #define LXC_CONFIG_DIR SYSCONF_DIR "/libvirt/lxc"
 #define LXC_STATE_DIR LOCAL_STATE_DIR "/run/libvirt/lxc"
 #define LXC_LOG_DIR LOCAL_STATE_DIR "/log/libvirt/lxc"
+#define LXC_AUTOSTART_DIR LOCAL_STATE_DIR "/libvirt/lxc/autostart"
 typedef struct __lxc_driver lxc_driver_t;
 struct __lxc_driver {

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