Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ossl.c: make legacy locking callbacks reentrant #155

Merged
merged 2 commits into from Sep 24, 2017

Conversation

rhenium
Copy link
Member

@rhenium rhenium commented Sep 24, 2017

Although it's not documented explicitly that the locking callbacks must
provide reentrant mutexes, it seems to be required.

Specifically, the session_remove_cb callback function of an SSL_CTX is
called in a critical section for CRYPTO_LOCK_SSL_CTX, which is shared
across the library. This leads, if the callback function calls another
OpenSSL function that will attempt to lock CRYPTO_LOCK_SSL_CTX, to
deadlock. SSL_CTX_free() is one example of such a function.

http://ci.rvm.jp/results/trunk@P895/64001

In preparation for making the mutexes reentrant. It is common to the
non-dynamic and the dynamic locking callbacks.
Although it's not documented explicitly that the locking callbacks must
provide reentrant mutexes, it seems to be required.

Specifically, the session_remove_cb callback function of an SSL_CTX is
called in a critical section for CRYPTO_LOCK_SSL_CTX, which is shared
across the library. This leads, if the callback function calls another
OpenSSL function that will attempt to lock CRYPTO_LOCK_SSL_CTX, to
deadlock. SSL_CTX_free() is one example of such a function.

	http://ci.rvm.jp/results/trunk@P895/64001
@rhenium rhenium merged commit 4945d36 into ruby:maint Sep 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant