| delorie.com/archives/browse.cgi | search |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 4AG59L671550364 |
| 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 4AG59L671550364 |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 307443857C68 |
| ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org 307443857C68 |
| ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731733450; cv=none; |
| b=no7m3igpBVnw+f7JiXoy3TfBu6iCmzOMv3ExHu0ZMU1agm9qUH1r4vQCRisged6TCgzL1ZZ5BLxqzZsQRPsu684ThWw90yDdZkrCQRApfiR2nQ9OUg8RwA2etpVAVkiyT3aut2hC8Y/vgaWS7OFYmtI208Cs7MVJ95gbd1CXSPI= | |
| ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
| t=1731733450; c=relaxed/simple; | |
| bh=C1NeeJJG1zazh62oXSCIRfQkBZEWUMqrSPDaZ18bTTU=; | |
| h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; | |
| b=ZMKg2fyjSzspuBOFmekLTT1aEotC1DNV1WzZ0W3NjTMXrrhrYF6PFfA/X7at3mjluHpMu2g+H7NojKHIlvRfs/LOl3gLxTyXqx6D6Is666x8QzDU32byVCdYC0L5m2uZNMNT6MnBAIxY5TCKebGjTFKqV5yiukikoOkHqK7DnUw= | |
| ARC-Authentication-Results: | i=1; server2.sourceware.org |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 307443857C68 |
| Date: | Sat, 16 Nov 2024 14:04:06 +0900 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Segfault in pthread_sigqueue() or sigtimewait() |
| Message-Id: | <20241116140406.06d1506716354c54eede7a2a@nifty.ne.jp> |
| In-Reply-To: | <bde4465a-717f-6509-8104-6c4885facbc6@t-online.de> |
| References: | <bde4465a-717f-6509-8104-6c4885facbc6 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 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | Takashi Yano via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> |
| Errors-To: | cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com |
| Sender: | "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com> |
| X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 4AG59L671550364 |
On Thu, 14 Nov 2024 13:55:36 +0100
Christian Franke wrote:
> After enabling the usage of pthread_sigqueue() in stress-ng, 'stress-ng
> --pthread ...' occasionally reports that child processes failed with
> SIGSEGV.
>
> The problem is unrelated to the recent fix of the signature of
> pthread_sigqueue():
> https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=1e8c92e
>
> It could be reproduced with Cygwin 3.5.4-1 and with current 3.6.0 TEST
> release if the signature is adjusted.
>
> Testcase (attached):
>
> $ gcc -O2 -o sigfault sigfault.c # Add -DBETA if compiling for a TEST
> release
>
> $ strace -o trace.log ./sigfault
> pthread_create({0xa000188d0}, ...)=0
> pthread_sigqueue(0xa000188d0, SIGUSR1, .)
> sigtimedwait(...)=30 (errno=0)
> ...
> sigtimedwait(...)=30 (errno=0)
> pthread_sigqueue(0xa000188d0, SIGUSR1, .)=0
> pthread_join(0xa000188d0, .)=0
> pthread_create({0xa000188d0}, ...)=0
> pthread_sigqueue(0xa000188d0, SIGUSR1, .)
> sigtimedwait(...)=30 (errno=0)
> pthread_sigqueue(0xa000188d0, SIGUSR1, .)=0
> pthread_join(0xa000188d0, .)=0
> pthread_create({0xa000188d0}, ...)=0
> pthread_sigqueue(0xa000188d0, SIGUSR1, .)
> Segmentation fault
>
> $ cat trace.log
> ...
> Â Â 78Â 103937 [main] sigfault 2074 sig_send: Waiting for pack.wakeup 0x21C
> Â Â 80Â 104017 [sig] sigfault 2074 sigpacket::process: signal 30 processing
> Â 147Â 104164 [sigfault] sigfault 2074 __set_errno: int
> sigwait_common(const sigset_t*, siginfo_t*, PLARGE_INTEGER):643 setting
> errno 11
> Â 103Â 104267 [sig] sigfault 2074 sigpacket::process: signal 30, signal
> handler 0x1
> Â Â 84Â 104351 [sigfault] sigfault 2074 sigwait_common: returning signal -1
> Â Â 81Â 104432 [sig] sigfault 2074 sigpacket::setup_handler: controlled
> interrupt. stackptr 0x7FFDFE220, stack 0x7FFDFE218, stackptr[-1] 0x100401109
> Â Â 78Â 104510 [sig] sigfault 2074 proc_subproc: args: 4, 1
> Â Â 74Â 104584 [sig] sigfault 2074 proc_subproc: clear waiting threads
> Â Â 71Â 104655 [sig] sigfault 2074 proc_subproc: finished clearing
> Â Â 70Â 104725 [sig] sigfault 2074 proc_subproc: returning 1
> Â 125Â 104850 [sig] sigfault 2074 _cygtls::interrupt_setup: armed
> signal_arrived 0x24C, signal 30
> Â Â 74Â 104924 [sig] sigfault 2074 sigpacket::setup_handler: signal 30
> delivered
> Â Â 83Â 105007 [sigfault] sigfault 2074 set_process_mask_delta: oldmask
> 0, newmask 20000000, deltamask 20000000
> --- Process 9568 (pid: 2074), exception c0000005 at 0000000000000001
> Â Â 80Â 105087 [sig] sigfault 2074 sigpacket::process: returning 1
> --- Process 9568 (pid: 2074) thread 7320 exited with status 0xc0000005
> --- Process 9568 (pid: 2074) thread 8928 exited with status 0xc0000005
> --- Process 9568 (pid: 2074) thread 6792 exited with status 0xc0000005
> --- Process 9568 (pid: 2074) thread 5020 exited with status 0xc0000005
> --- Process 9568 thread 9020 exited with status 0xc0000005
> --- Process 9568 exited with status 0xc0000005
>
> I guess the problem occurs because pthread_sigqueue() is sometimes
> issued after the thread function already returned. The thread pointer
> should be valid until pthread_join() is called. Sorry if I missed something.
Thansk for the report and especially for the test case.
I could reporduce the problem using your test case.
I'll look into this.
--
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |