DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 54GCF5ni3953778 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 54GCF5ni3953778 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=izZxW8X6 X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 392D3385703C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1747397704; bh=XlqLywSAFPEwYkOTC4AQelYoR1M6Mjyhs/GNpgwg1UE=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=izZxW8X6HRiOsH/uQp5psBGizs0fcWKtiTizEql6hpEQJ+Tq+YrCN0U68x2yvmv35 X3zBI6T6kpl9mLAhO/LNKj1HfEuAfTVCCjVU/jYXIeunn75VzePZw4IaCBkfGMCgfd Bn0B3crfj8McnNwGNukGPVuNLV1KTlwPJdHVTly8= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 315D93858C56 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 315D93858C56 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747397645; cv=none; b=ESWtIsg7VIA9KAGNekagFec/MGQ16Gbdy/iAktekXSaAdavTvssOK0KBsIkgfZmeyiSmTu5wdliBx6gGvBzDn0bJy6krME/ttXevp+xKnwh5skbPbYF62jA83jYLlrtWpfwR6+k2mLumB00sFvWcjaGe0tmt0PHpDnrxHbhO7s8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747397645; c=relaxed/simple; bh=9rjQCzVRap1QasjupM/aOFeTfIZcap2+JoyOZYFQ8l8=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=D2fWWsO1XtP6cOcgYccwpBECBhugHzd3kLvK7J4m/ZWlyJptl2+dydvddhY1580qlk9o0Z9YhlniF32sOU2yZ/LDYeOFkEFUN12KrNw3l0+gxihGXRYJw/cjwf1qo4W5+hMbuEBtSgCyvm3XViBbDJgIyDDemdvpMgoxUA0z2ws= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 315D93858C56 Date: Fri, 16 May 2025 21:14:00 +0900 To: cygwin AT cygwin DOT com Subject: Re: strace: infinite exception c0000005 loop on segmentation fault Message-Id: <20250516211400.84e5ff3351f557a313618ee7@nifty.ne.jp> In-Reply-To: <320ee4eb-a06d-150d-ef12-3dc501bbd60b@t-online.de> References: <320ee4eb-a06d-150d-ef12-3dc501bbd60b AT t-online DOT de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 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: Takashi Yano via Cygwin Reply-To: Takashi Yano 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 54GCF5ni3953778 Hi Christian, Thanks for the report. On Fri, 16 May 2025 13:46:21 +0200 Christian Franke wrote: > Found during check why SIGSEGV handler could interrupt SIGALRM handler > (which does not happen on Linux): > https://sourceware.org/pipermail/cygwin-patches/2025q2/013703.html Perhaps, delay of calling SIGSEGV handler after segfault happen is much larger than linux. If segfault happen in the user code, the exception is raised, then, the SIGSEGV is sent to myself. After that, wait_sig() thread receives SIGSEGV, then, try to call SIGSEGV handler. However, if the main thread is in the cygwin1.dll or windows kernel, calling the handler will be pending until it returns from cygwin1.dll or windows kernel. This delay can be much larger than that observed in linux. > Testcase: > > $ uname -r # Also occurs with 3.6.1-1.x86_64 > 3.7.0-0.95.g854150fda310.x86_64 > > $ cat sigsegv.c > int main() > { >   *(volatile char *)0 = 0; >   return 42; // NOTREACHED > } > > $ gcc -o sigsegv sigsegv.c > > $ ./sigsegv # OK > Segmentation fault > > $ echo $? > 139 > > $ (sleep 5; taskkill /f /im strace.exe) & strace ./sigsegv # Infinite loop > ... > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000100401092 > --- Process 11224 (pid: 2162), exception c0000005 at 0000000 > SUCCESS: ... (localized message from taskkill) > > > The problem also occurs if a SIGSEGV handler is present. The handler > code is not executed if strace is used but works as expected without strace. I could reproduce that. And also found cygwin 3.4.10 does not have this issue. I'll look into this. -- Takashi Yano -- 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