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 <takashi.y...@nifty.ne.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