strace: infinite exception c0000005 loop on segmentation fault

Christian Franke Christian.Franke@t-online.de
Fri May 16 11:46:21 GMT 2025


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

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.

-- 
Regards,
Christian



More information about the Cygwin mailing list