[libvirt] ESX driver connection private data fix

ryan woodsmall rwoodsmall at gmail.com
Wed Apr 4 22:22:47 UTC 2012


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 at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: esx_conn_privData.patch
Type: application/octet-stream
Size: 492 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120404/bc4f814b/attachment-0001.obj>


More information about the libvir-list mailing list