diff options
author | Matthias Kraft <Matthias.Kraft@softwareag.com> | 2018-03-19 13:37:46 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-03-20 21:33:50 -0400 |
commit | 4af14b7b018750bf3584587068211948924738fb (patch) | |
tree | 5092bda7cccadaedf680b3a3ad85a748f1910be6 /crypto/init.c | |
parent | d316cdcf6d8d6934663278145fe0a8191e14a8c5 (diff) |
Add dladdr() for AIX
Although it deviates from the actual prototype of DSO_dsobyaddr(), this
is now ISO C compliant and gcc -Wpedantic accepts the code.
Added DATA segment checking to catch ptrgl virtual addresses. Avoid
memleaks with every AIX/dladdr() call. Removed debug-fprintf()s.
Added test case for DSO_dsobyaddr(), which will eventually call dladdr().
Removed unecessary AIX ifdefs again.
The implementation can only lookup function symbols, no data symbols.
Added PIC-flag to aix*-cc build targets.
As AIX is missing a dladdr() implementation it is currently uncertain our
exit()-handlers can still be called when the application exits. After
dlclose() the whole library might have been unloaded already.
Signed-off-by: Matthias Kraft <makr@gmx.eu>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5668)
Diffstat (limited to 'crypto/init.c')
-rw-r--r-- | crypto/init.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/init.c b/crypto/init.c index cc3da4fb7d..27be7b6123 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -119,6 +119,15 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base) ERR_set_mark(); dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE); +# ifdef OPENSSL_INIT_DEBUG + fprintf(stderr, "OPENSSL_INIT: obtained DSO reference? %s\n", + (dso == NULL ? "No!" : "Yes.")); + /* + * In case of No!, it is uncertain our exit()-handlers can still be + * called. After dlclose() the whole library might have been unloaded + * already. + */ +# endif DSO_free(dso); ERR_pop_to_mark(); } @@ -685,6 +694,12 @@ int OPENSSL_atexit(void (*handler)(void)) ERR_set_mark(); dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE); +# ifdef OPENSSL_INIT_DEBUG + fprintf(stderr, + "OPENSSL_INIT: OPENSSL_atexit: obtained DSO reference? %s\n", + (dso == NULL ? "No!" : "Yes.")); + /* See same code above in ossl_init_base() for an explanation. */ +# endif DSO_free(dso); ERR_pop_to_mark(); } |