[openssl-dev] shlibloadtest failure on non-Linux

Nick Reilly nreilly at blackberry.com
Tue May 9 13:43:45 UTC 2017


Hi,
I just ported OpenSSL 1.1.0e to QNX and ran in to an issue on 
shlibloadtest and it trying to unload the shared libraries in 
conjunction with the code in crypto/init.c

1) crypto/init.c at line 106 deliberately leaks a reference to prevent 
the library from unloading unless OPENSSL_USE_NODELETE is defined, yet 
shlibloadtest doesn't test for whether this is set. I think the 
shlibloadtest should only test the dlclose() return value on if 
OPENSSL_USE_NODELETE is set.

2) crypto/init.c at line 77 does "atexit(OPENSSL_cleanup)". If I try 
defining OPENSSL_USE_NODELETE then this atexit() handler is meant to 
cleanup on unload of the shared library, but this meaning of atexit() is 
Linux specific. It is not required in POSIX and the Linux manpage lists 
this usage under the "Linux notes" section. In QNX there must be no 
atexit() handlers registered if the library is being unloaded, otherwise 
there is a forced abort() called from the dynamic linker. I think that 
rather than using the atexit() mechanism some other mechanism e.g. 
function attribute of destructor on gcc should be used.

Regards,
Nick.


More information about the openssl-dev mailing list