Repository navigation
x509store: do not suppress exceptions in verify_callback - #1166
Merged
rhenium merged 2 commits intoNov 23, 2026
Merged
Conversation
Currently, verify_callback has no common place to store the jump tag
type when an exception is raised or the thread is interrupted, so it
suppresses the jump and emits a warning instead.
Use Fiber-local storage for the callback state. Wrap all callers that
may invoke verify_callback with ossl_cb_state_{begin,end}() so that
the suspended jump can be resumed afterward.
[ Known limitations: A user can freeze the Thread object to make it
suppress exceptions again. A user can store a random Fixnum in
Thread.current[:__ossl_cb_state__] to break ruby/openssl. I consider
these out of scope at this time, because there doesn't seem to be a
better alternative. ]
ossl_clear_error() is often used when we are about to resume a jump with rb_jump_tag(). It should not raise an exception or clobber the current errinfo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracted from #1080
x509store: do not suppress exceptions in verify_callback
Currently,
verify_callbackhas no common place to store the jump tag type when an exception is raised or the thread is interrupted, so it suppresses the jump and emits a warning instead.Use Fiber-local storage for the callback state. Wrap all callers that may invoke
verify_callbackwithssl_cb_state_{begin,end}()so that the suspended jump can be resumed afterward.Known limitations: A user can freeze the
Threadobject to make it suppress exceptions again. A user can store a random Fixnum inThread.current[:__ossl_cb_state__]to break ruby/openssl. I consider these out of scope at this time, because there doesn't seem to be a better alternative.ossl.c: fix possible exceptions in ossl_clear_error()
ossl_clear_error()is often used when we are about to resume a jump withrb_jump_tag(). It should not raise an exception or clobber the current errinfo.