Skip to content

macOS Rubies need Homebrew openssl@4 >= 4.1 since #980; an older 4.x segfaults instead of erroring #981

Open

Description

@dinisnunes1

What changed: since the builds added in #980, the macOS arm64 Rubies link Homebrew openssl@4 instead of openssl@3 (I checked 3.4.13 and 4.0.10). 4.0.10 is built against openssl@4 4.1.0; 4.0.9 linked openssl@3.

What happens with ruby/setup-ruby@v1 and Ruby 4.0.10 on a third-party macOS 26 arm64 runner:

openssl@4 on the machine Result
None gem install bundler fails: OpenSSL is not available
4.0.1 Ruby loads, then OpenSSL::PKCS7#verify([], …) segfaults (backtrace below)
4.1.0 (local repro) Works

Ask: I know the README asks self-hosted runners to match the GitHub image's libssl, so this is expected. Could the self-hosted section mention that macOS builds now need Homebrew openssl@4 at least as new as the one they were built with? A clear error from setup-ruby when the loaded OpenSSL is older than the build's would also have saved a lot of debugging.

Backtrace and repro
[BUG] Segmentation fault at 0x0000000000000000
ruby 4.0.10 (2026-11-19 revision a704b7cd95) +PRISM [arm64-darwin24]
openssl.bundle(ossl_x509_ary2sk0+0x50) ext/openssl/ossl.c:66
openssl.bundle(ossl_pkcs7_verify+0x12c) ext/openssl/ossl_pkcs7.c:797

Reproduced locally with the released 4.0.10 tarball and the script below: it passes with openssl@4 4.1.0, and with the 4.0.1 bottle it segfaults in ossl_x509_ary2sk0 (ossl.c:66) already at OpenSSL::PKCS7.sign(…, [], …).

require 'openssl'

puts "ruby #{RUBY_VERSION}, #{OpenSSL::OPENSSL_LIBRARY_VERSION}, openssl gem #{OpenSSL::VERSION}"

key = OpenSSL::PKey::RSA.new(2048)
cert = OpenSSL::X509::Certificate.new
cert.version = 2
cert.serial = 1
cert.subject = cert.issuer = OpenSSL::X509::Name.parse('/CN=repro')
cert.public_key = key
cert.not_before = Time.now
cert.not_after = Time.now + 3600
cert.sign(key, OpenSSL::Digest.new('SHA256'))

der = OpenSSL::PKCS7.sign(cert, key, '<plist/>', [], OpenSSL::PKCS7::BINARY).to_der

# Same call as fastlane_core/provisioning_profile.rb:115
profile = OpenSSL::PKCS7.new(der)
result = profile.verify([], OpenSSL::X509::Store.new, nil, OpenSSL::PKCS7::NOVERIFY)
puts "verify returned #{result}, data=#{profile.data}"

Activity

  1. eregon commented on Nov 22, 2026

    @eregon
    Member

    Right, this is not ideal.
    Documenting it is fine, could you make a PR?
    Checking what's installed would be very messy and slow, so that I don't think we should do.

    ruby-build allows libssl 4 for Ruby 4.0 and I guess GHA's macOS runners have openssl@4 installed and it gets picked.

    One possibility would be to use RUBY_BUILD_VENDOR_OPENSSL=true, so to vendor libssl with ruby builds, on macOS and probably Linux too. It would be in general safer with the system changing which libssl it ships, but also increase the size of every download and build time. And that also means security fixes from libssl wouldn't be applied, which is the biggest issue with that approach.

  2. eregon commented on Nov 22, 2026

    @eregon
    Member

    Re the segfault maybe worth discussing at https://github.com/ruby/openssl/ to see if anything could be done there to have a clearer error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions