Subject: RE: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment

RE: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment

From: Paolo Elefante <paolo.elefante_at_ericsson.com>
Date: Tue, 19 Apr 2016 15:43:43 +0000

Hello Ales,
Thank you so much for your support!
I installed the rpm suggested by you (libssh2-1-1.4.3-16.1.10575.2.PTF.974691.x86_64) and verified that my application works perfectly :-)

I see that the bug I have experienced is described here http://trac.libssh2.org/ticket/279 and it has been fixed also in the Version 1.5.0 where it is highlighted in the change log as "openssl: initialize the digest context before calling EVP_DigestInit()"

I only have one more doubt and question at the moment. I'm wondering if this bug fix is responsible for the random crash fixed in the 1.6.0.
In the change log https://www.libssh2.org/changes.html I see that libssh2 version 1.6.0 contains a fix for: "openssl.c: fix possible segfault in case EVP_DigestInit fails".

Are those problems related each other?
Do you know if the libssh2 PTF bsc#974691 also contains the bugfix "openssl.c: fix possible segfault in case EVP_DigestInit fails" ?

Best Regards
/Paolo

-----Original Message-----
From: libssh2-devel [mailto:libssh2-devel-bounces_at_cool.haxx.se] On Behalf Of Ales Novak
Sent: martedì 19 aprile 2016 11:24
To: libssh2 development
Subject: Re: Multithreaded SFTP application crash on CRYPTO_free in SUSE SLES12 environment

Hi Paolo,

I believe this bug is fixed in the libssh2 PTF which SUSE provided (to
Ericsson) last week within the bsc#974691. Can you please try that one?

On 2016-4-19 11:13, Paolo Elefante wrote:

>
> Hi there,
>
> I use libssh2 (libssh2-1-1.4.3-16.1.x86_64) to establish SFTP connections in parallel in my multithreaded application running on Linux SUSE.
>
> That code perfectly works on SUSE SLES11, but as I tried to migrate to SLES12 I got a serious crash.
>
>  
>
> As the application tries to open an SFTP connection, I get a systematic crash on “CRYPTO_free” when invoking ‘libssh2_session_handshake’.
>
> I have checked the core dump using symbols and I’m sure that both TCP connection and SSH Session have been established (‘libssh2_session_init’ is successful).
>
>  
>
> In detail, libssh2_session_handshake crashes while invoking HMAC_Init_ex, EVP_DigestInit_ex, CRYPTO_free:
>
> #0 0x00007fe3600eb0a7 in raise () from /lib64/libc.so.6
>
> #1 0x00007fe3600ec458 in abort () from /lib64/libc.so.6
>
> #2 0x00007fe360128764 in __libc_message () from /lib64/libc.so.6
>
> #3 0x00007fe36012dfce in malloc_printerr () from /lib64/libc.so.6
>
> #4 0x00007fe361e6b3fd in CRYPTO_free () from /lib64/libcrypto.so.1.0.0
>
> #5 0x00007fe361ef4009 in EVP_DigestInit_ex () from
> /lib64/libcrypto.so.1.0.0
>
> #6 0x00007fe361e79360 in HMAC_Init_ex () from
> /lib64/libcrypto.so.1.0.0
>
> #7 0x00007fe36291ee7a in ?? () from /usr/lib64/libssh2.so.1
>
> #8 0x00007fe36292d3e9 in ?? () from /usr/lib64/libssh2.so.1
>
> #9 0x00007fe362924bd3 in libssh2_session_handshake () from
> /usr/lib64/libssh2.so.1
>
>  
>
> I have initialized OpenSSL for a multithreaded environment using
> static locking callbacks. I have also verified that callbacks are triggered by the underlying openssl stratum.
>
> I initialized libssh2 using “libssh2_init(0)”
>
>  
>
> I guess there's problem in the setup of my environment, but I can’t figure it out.
>
>  
>
> The same code works on SUSE SLES11 where my application linked
> libcrypto.so.0.9.8 and libssl.so.0.9.8, on the contrary on SLES12 my
> application is linking
> libcrypto.so.1.0.0 and libssl.so.1.0.0.
>
>  
>
> Has anyone experienced this problem or have a suggestion?
>
>  
>
> Thank you so much for your support.
>
>  
>
> Best Regards
>
> /Paolo
>
>  
>
>
>

--
Ales Novak
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-04-19