[libvirt] Core dump caused by misusing openssl in multithread scenario!

Benjamin Wang (gendwang) gendwang at cisco.com
Tue Oct 2 02:57:46 UTC 2012


Hi Daniel,
   My comments are as following:
1. Currently curl_easy_init method is called from esxVI_CURL_Connect method in esx_vi.c. And curl_global_init method is called by curl_easy_init. If we move
Curl_global_init to virInitialize, shall we still need to call curl_easy_init from esxVI_CURL_Connect? Did the latest version fix this problem?
2. If we need to use openssl in multi-threads, we must register the two callbacks. Currently libcurl didn't do it. If we will not register these two callbacks in libvirt,
How to do?

B.R.
Benjamin Wang

-----Original Message-----
From: Daniel P. Berrange [mailto:berrange at redhat.com] 
Sent: 2012年10月1日 16:24
To: Benjamin Wang (gendwang)
Cc: libvir-list at redhat.com; Yang Zhou (yangzho)
Subject: Re: [libvirt] Core dump caused by misusing openssl in multithread scenario!

On Sat, Sep 29, 2012 at 01:31:07PM +0000, Benjamin Wang (gendwang) wrote:
> Hi,
>   I am running libvirt with ESXi driver in multithread scenario to access ESXi by https. Sometimes a core dump will be generated as following:
> #0  0x0000003f9b030265 in raise () from /lib64/libc.so.6
> #1  0x0000003f9b031d10 in abort () from /lib64/libc.so.6
> #2  0x0000003f9b06a84b in __libc_message () from /lib64/libc.so.6
> #3  0x0000003f9b072fae in _int_malloc () from /lib64/libc.so.6
> #4  0x0000003f9b074cde in malloc () from /lib64/libc.so.6
> #5  0x0000003f9b07963b in strerror () from /lib64/libc.so.6
> #6  0x0000003fa188032a in ERR_load_ERR_strings () from 
> /lib64/libcrypto.so.6
> #7  0x0000003fa187fde9 in ERR_load_crypto_strings () from 
> /lib64/libcrypto.so.6
> #8  0x0000003fa48309d9 in SSL_load_error_strings () from 
> /lib64/libssl.so.6
> #9  0x00002aaaba8e612e in Curl_ossl_init () from 
> /opt/CSCOppm-unit/hypervisor/libcurl/lib/libcurl.so.4
> #10 0x00002aaaba8ee6c1 in curl_global_init () from 
> /opt/CSCOppm-unit/hypervisor/libcurl/lib/libcurl.so.4
> #11 0x00002aaaba8ee6f8 in curl_easy_init () from 
> /opt/CSCOppm-unit/hypervisor/libcurl/lib/libcurl.so.4
> #12 0x00002aaaba0d932b in esxVI_SessionIsActive (ctx=0x2aaac093ca80, 
> sessionID=0x2aaac06932a0 "`3i\300\252*", userName=0x2aaac0ae6e80 
> "root", output=0xffffffffffffffff) at 
> esx/esx_vi_methods.generated.c:599
> #13 0x00002aaaba0c7a60 in esxStorageVolumeLookupByKey (conn=0x7412, 
> key=0x76c1 <Address 0x76c1 out of bounds>) at 
> esx/esx_storage_driver.c:825
> 
> I checked that currently ESXi driver didn't initialize openssl. 
> Because libcurl will not handle openssl for multi-thread. According to 
> openssl API, libvirt should

No code in libvirt should assume curl uses openssl - it may well have been compiled with gnutls, or nss instead. The actual flaw here is that libvirt does not invoke 'curl_global_init' from virInitialize.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list