SIGSEGV handling and stack overflow handling broken in Cygwin 3.6.0
Bruno Haible
bruno@clisp.org
Mon Mar 24 12:26:27 GMT 2025
Hi,
Gnulib contains a few unit tests for
- SIGSEGV handling,
- stack overflow handling (via signal SIGSEGV or SIGBUS).
In Cygwin 3.4.6, SISGEGV handling was fine, and stack overflow handling
worked at least for the first stack overflow.
In Cygwin 3.5.6, SISGEGV handling was fine, but stack overflow handling
randomly worked for the first stack overflow or did not work, reminding
me of the raise() bug [1].
In Cygwin 3.6.0, SISGEGV handling and stack overflow handling are both
broken. Not randomly, but always reproducible.
How to reproduce
================
1. Create a testdir for gnulib's c-stack module:
$ ./gnulib-tool --create-testdir --dir=../testdir1 --single-configure c-stack
2. Transfer it to a Cygwin machine.
3. Build it: ./configure && make && make check
SIGSEGV handling
----------------
The test case is
$ ./test-sigsegv-catch-segv2
Expected output (like on glibc and Cygwin 3.4.6, 3.5.6):
Doing SIGSEGV pass 1.
Fault 1 caught.
Doing SIGSEGV pass 2.
Fault 2 caught.
Test passed.
Actual output in Cygwin 3.6.0:
Doing SIGSEGV pass 1.
Fault 1 caught.
Doing SIGSEGV pass 2.
Fault 2 caught.
Aborted
Stack overflow handling
-----------------------
The test cases are
$ ./test-c-stack; echo $?
and
$ ./test-sigsegv-catch-stackoverflow1; echo $?
Expected output (like on GNU/Linux):
$ ./test-c-stack; echo $?
test-c-stack: stack overflow
1
$ ./test-sigsegv-catch-stackoverflow1; echo $?
Starting recursion pass 1.
Stack overflow 1 caught.
Starting recursion pass 2.
Stack overflow 2 caught.
Test passed.
0
Actual output on Cygwin 3.4.6:
$ ./test-c-stack; echo $?
test-c-stack: stack overflow
1
$ ./test-sigsegv-catch-stackoverflow1; echo $?
Starting recursion pass 1.
Stack overflow 1 caught.
Starting recursion pass 2.
0
Actual output on Cygwin 3.5.6:
$ ./test-c-stack; echo $?
Sometimes
0
Sometimes
test-c-stack: stack overflow
1
$ ./test-sigsegv-catch-stackoverflow1; echo $?
Sometimes
Starting recursion pass 1.
0
Sometimes
Starting recursion pass 1.
Stack overflow 1 caught.
Starting recursion pass 2.
0
Actual output on Cygwin 3.6.0:
$ ./test-c-stack; echo $?
0
$ ./test-sigsegv-catch-stackoverflow1; echo $?
Starting recursion pass 1.
0
Please CC me in your replies.
Bruno
[1] https://sourceware.org/pipermail/cygwin/2024-December/256973.html
More information about the Cygwin
mailing list