Hi, first time poster, my apologies if this is not the correct avenue.
Since release 0.9.11, I've been getting a segfault in virsh attempting
to access an ESXi 4.1 host. GDB reports it as such:
**
Program received signal SIGSEGV, Segmentation fault.
esxConnectToHost (vCenterIpAddress=0x7fffffffd640,
auth=0x7ffff7fef5e0, conn=0x675780) at esx/esx_driver.c:726
726 if (virAsprintf(&url, "%s://%s:%d/sdk",
priv->parsedUri->transport,
(gdb) bt
#0 esxConnectToHost (vCenterIpAddress=0x7fffffffd650,
auth=0x7ffff7fef5e0, conn=0x675780) at esx/esx_driver.c:726
#1 esxOpen (conn=0x675780, auth=0x7ffff7fef5e0, flags=<optimized
out>) at esx/esx_driver.c:1052
#2 0x00007ffff7bc243a in do_open (name=0x6745a0
"esx://XXX/?no_verify=1", auth=0x7ffff7fef5e0, flags=0) at
libvirt.c:1227
#3 0x00007ffff7bc48e6 in virConnectOpenAuth (name=0x6745a0
"esx://XXX/?no_verify=1", auth=0x7ffff7fef5e0, flags=0) at
libvirt.c:1456
#4 0x000000000040ac8f in vshInit (ctl=0x7fffffffe210) at virsh.c:19288
#5 main (argc=<optimized out>, argv=0x7fffffffe508) at virsh.c:20046
**
Digging through the code a bit, I found that in esxOpen(), the "conn"
virConnectPtr var is passed to esxConnectToHost() with a nil pointer
to a virConnect "privateData" pointer. The hypervisor transport type
(among other things in "parsedUri") is stored here, and a
crash/segfault occurs in esxConnectToHost() when attempting to access
the transport for virAsprintf() at line 726 of src/esx/esx_driver.c.
This patch just makes sure we're pointing to something before
attempting to use anything in the struct.
Cleanly applied to git from this afternoon, built and successfully
tested on a Fedora 16/x86_64 VM accessing an ESXi 4.1 node.
--
ryan woodsmall
rwoodsmall(a)gmail.com