Subject: Re: libssh crash on Mac

Re: libssh crash on Mac

From: Peter Stuge <peter_at_stuge.se>
Date: Tue, 13 Aug 2019 12:06:34 +0000

Jan Ehrhardt wrote:
> Libssh2 does not need any engine, so it is safe to remove both
> ENGINE_load_builtin_engines() and ENGINE_register_all_complete() by
> applying this patch in src/openssl.h:
> https://github.com/Jan-E/iSSH2/commit/6b2b61d56fc43642980aacc529c9d9d14263cebf#diff-47bf3a78aa165576c6c85a942ddf572bR1
..
> In libssh2 1.9.0+ you could also recompile with a defined
> OPENSSL_NO_ENGINE.

True as that may be, it merely papers over the actual programming error.

OpenSSL wouldn't crash unless it is being called in a wrong way, through
libssh2.

In particular, libssh2_init(3) notes that the function is not thread
safe. Leos test case in a minimal SFTP application working well
suggests that a complexity in the full application causes the crash.

Multiple threads are a fairly likely candidate, but no matter what the
cause is, ensuring that libssh2_init() is only called a single time on
startup could solve the problem properly.

//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2019-08-13