DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 55MHnLhu3326723 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 55MHnLhu3326723 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=v/Enteb9 X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47D4D3856979 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1750613264; bh=xnrHndu4ltZGYabUDfTySSW3JVGb2WLxXktq/aZrmL8=; h=Date:To:cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=v/Enteb9j4mu+KZwQB0pRdOM34NnlXMCo25DZMzSB0tXnyN2CRPi5x/+58N+tuFm8 v7q+9KLU45mHoD4A24UvhtpdSPYpn0i8nw4ziuIRc/6yiesDx+4D7mGEhsvWxolrzY mgSTyyfZqjrRX82G+IUieIMU2zHj8AH6LH6QpK9s= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4A6E0385DDC5 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4A6E0385DDC5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750611879; cv=none; b=M1D/EtNw2SIszhPmRV64EZRNqHhepSvdDQ9GNgRT3AP7gbpMD2PIAv+6keCVW4ry129mAUttrEdydPkyun1CwQiQm/ODY7+a25PWg+zGnhHW0Nx9UjJJiNR8yHFRs05hJYg89EwMNpVf/ZNJfBa2BJwhZ84LIqCKmLNtJu0BgPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750611879; c=relaxed/simple; bh=P/9MONLeXzXTKkL/X2UrodfD+azrRQrU7RkUT59pU5o=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=F4t6tsNDnZe5+jzGydAQs3N2giyBMawry7HCT+7YzH0I4X4tgwYk8sy9MPyhH1FEWNP8YGPpqYNAkfECKMginX13BlQaS/bMlGrzQXHCEgJitVxS3z89wojTeT/CBEMW5MiSmLGTNXGHkHJJvRP+HA8DsR08E1aghW1QEGksNKY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A6E0385DDC5 Date: Sun, 22 Jun 2025 10:04:38 -0700 (PDT) X-X-Sender: jeremyd AT resin DOT csoft DOT net To: Daisuke Fujimura cc: cygwin AT cygwin DOT com Subject: Re: SIGSEGV in pthread_testcancel() likely due to NULL TLS access (Re: A process spawned inside gem command running on latest ruby segfaults) In-Reply-To: Message-ID: References: <7a8fd4a7-e07c-4d09-9741-72d3b2b27b06 AT dronecode DOT org DOT uk> MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.30 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jeremy Drake via Cygwin Reply-To: Jeremy Drake Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 55MHnLhu3326723 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= out>) at crypto/threads_pthread.c:110 > #5 0x00000003ff541922 in init_thread_remove_handlers > (handsin=handsin AT entry=0x0) at crypto/initthread.c:178 > #6 0x00000003ff541d43 in OPENSSL_thread_stop () at crypto/initthread.c:235 > #7 0x00000003ff53fdd3 in DllMain (hinstDLL=, > fdwReason=, lpvReserved=) > 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