Skip to content

Commit

Permalink
Flaky repro for compaction issue
Browse files Browse the repository at this point in the history
ossl_ssl_initialize() sets a Ruby reference on an OpenSSL handle and
it's retrived later for calling callbacks such as session_new_cb. There
is nothing marking the reference that lives on the SSL handle, so the
reference could move and cause crashes later when the stale reference is
used.

On my machine I get a crash with this change running the following tests
in a loop:

    bundle exec rake test TEST=test/openssl/test_ssl_session.rb TESTOPTS='-n/cb/'
  • Loading branch information
XrXr committed Oct 13, 2021
1 parent e3a4093 commit ad02bb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/openssl/test_ssl_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,12 @@ def test_dup
def server_connect_with_session(port, ctx = nil, sess = nil)
sock = TCPSocket.new("127.0.0.1", port)
ctx ||= OpenSSL::SSL::SSLContext.new
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
@ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
itself
if GC.respond_to?(:verify_compaction_references)
GC.verify_compaction_references(double_heap: true, toward: :empty)
end
ssl = @ssl
ssl.session = sess if sess
ssl.sync_close = true
ssl.connect
Expand Down

0 comments on commit ad02bb9

Please sign in to comment.