[openssl-commits] [openssl] OpenSSL_1_1_0-stable update
Matt Caswell
matt at openssl.org
Thu May 4 14:58:23 UTC 2017
The branch OpenSSL_1_1_0-stable has been updated
via ccceda842e3cc9f97059502b8597bad52fe4bf50 (commit)
from 6e7e171d0a02cf2b45c3122a952e62fe3cc7d5c7 (commit)
- Log -----------------------------------------------------------------
commit ccceda842e3cc9f97059502b8597bad52fe4bf50
Author: Matt Caswell <matt at openssl.org>
Date: Thu May 4 12:51:18 2017 +0100
Don't leave stale errors on queue if DSO_dsobyaddr() fails
The init code uses DSO_dsobyaddr() to leak a reference to ourselves to
ensure we remain loaded until atexit() time. In some circumstances that
can fail and leave stale errors on the error queue.
Fixes #3372
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3383)
(cherry picked from commit 689f112d9806fa4a0c2f8c108226639455bc770d)
-----------------------------------------------------------------------
Summary of changes:
crypto/init.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/crypto/init.c b/crypto/init.c
index c730e38..647cfb6 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -104,13 +104,15 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base)
# else
/*
* Deliberately leak a reference to ourselves. This will force the library
- * to remain loaded until the atexit() handler is run a process exit.
+ * to remain loaded until the atexit() handler is run at process exit.
*/
{
DSO *dso = NULL;
+ ERR_set_mark();
dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE);
DSO_free(dso);
+ ERR_pop_to_mark();
}
# endif
#endif
@@ -645,8 +647,10 @@ int OPENSSL_atexit(void (*handler)(void))
{
DSO *dso = NULL;
+ ERR_set_mark();
dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);
DSO_free(dso);
+ ERR_pop_to_mark();
}
# endif
}
More information about the openssl-commits
mailing list