On 09/05/17 14:43, Nick Reilly wrote:
> 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.

I'm not sure why this makes a difference. The return value of dlclose()
tells you whether there has been an error or not. Not whether the
library has actually been removed from address space. Or am I missing
your point?

> 
> 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.

No. The whole point of OPENSSL_USE_NODELETE is to indicate that the
library won't be unloaded until process exit because we've ensured that
through some other mechanism (e.g. because we built it using
"-znodelete" on Linux). We do not rely on the linux specific behaviour.
If your platform doesn't have some other mechanism then you need to use
the default "deliberate leak" approach.

Matt
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to