On Sun, 22 Jun 2025, Daisuke Fujimura via Cygwin wrote:

> The reproduction procedure could be simplified.
>
> A segmentation fault (SIGSEGV) occurs when running a Ruby script using
> Ruby 3.4.2 (test package) on Cygwin 3.6.3-1 (x86_64), where Thread.new
> is used to require 'openssl' inside a thread.
>
> The crash path leads from OpenSSL’s OPENSSL_thread_stop() to
> CRYPTO_THREAD_write_lock() and then pthread_rwlock_wrlock(), which
> invokes pthread_testcancel(). At that point, a NULL pointer
> dereference seems to occur, possibly during access to TLS data.
>
> Thread 8 "repro.rb:1" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 7380.0x25e4]
> 0x0000000000000000 in ?? ()
> (gdb) where
> #0 0x0000000000000000 in ?? ()
> #1 0x00007ffe4ad2a0e4 in pthread_testcancel () at
> /usr/src/debug/cygwin-3.6.3-1/winsup/cygwin/thread.cc:399
> #2 pthread_rwlock_wrlock (rwlock=0xa002a9010) at
> /usr/src/debug/cygwin-3.6.3-1/winsup/cygwin/thread.cc:4352
> #3 0x00007ffe4ae0b0d4 in _sigfe () at sigfe.s:35
> #4 0x00000003ff54e3f9 in CRYPTO_THREAD_write_lock (lock=<optimized
> out>) at crypto/threads_pthread.c:110
> #5 0x00000003ff541922 in init_thread_remove_handlers
> (handsin=handsin@entry=0x0) at crypto/initthread.c:178
> #6 0x00000003ff541d43 in OPENSSL_thread_stop () at crypto/initthread.c:235
> #7 0x00000003ff53fdd3 in DllMain (hinstDLL=<optimized out>,
> fdwReason=<optimized out>, lpvReserved=<optimized out>)
> at crypto/dllmain.c:38
> #8 0x00007ffe8f2fd6ac in ?? ()
> #9 0x00007ffe8f38b590 in ?? ()
> #10 0x00007ffe8f38b590 in ?? ()
> #11 0x0000000000000000 in ?? ()

This should be fixed by test release openssl-3.0.16-2
(https://cygwin.com/pipermail/cygwin-announce/2025-May/012341.html).  I
don't know what the plan is for making that stable, or getting a patch
upstream.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to