[newlib-cygwin/main] Cygwin: setjmp/longjmp: drop setting spinning flag

Corinna Vinschen corinna@sourceware.org
Thu Dec 5 23:49:42 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=96d856320a1d740546eaf8a6c0ddb3d489e10492

commit 96d856320a1d740546eaf8a6c0ddb3d489e10492
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Thu Dec 5 18:34:02 2024 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Dec 5 21:16:34 2024 +0100

    Cygwin: setjmp/longjmp: drop setting spinning flag
    
    Per the comment in _cygtls::interrupt_now(), the spinning flag
    is supposed to guard that the targeted thread is about to enter
    the Cygwin DLL.  Setting spinning has then been added to _sigfe,
    _sigbe, sigdelayed and stabilize_sig_stack, the latter being called
    from setjmp/longjmp.
    
    However, setjmp/longjmp only enter the DLL in case of a pending
    signal, calling _cygtls::call_signal_handler(). This in turn is
    already guarded by setting the incyg flag, and there's no other
    action in stabilize_sig_stack which might interfere with the
    signal setup.  All the rest of setjmp/longjmp is plain userspace.
    
    Therefore, drop setting the spinning flag from stabilize_sig_stack,
    because it results in dropped signals in tight longjmp loops.
    
    Fixes: edc4f86ad2827 ("* Makefile.in (clean): Remove sigfe.s.")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/scripts/gendef | 1 -
 1 file changed, 1 deletion(-)

diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index 377ceb59b2c8..11cdf584abae 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -332,7 +332,6 @@ stabilize_sig_stack:
 	movq	%gs:8,%r12
 1:	movl	\$1,%r10d
 	xchgl	%r10d,_cygtls.stacklock(%r12)	# try to acquire lock
-	movl	%r10d,_cygtls.spinning(%r12)	# flag if we are waiting for lock
 	testl	%r10d,%r10d
 	jz	2f
 	pause


More information about the Cygwin-cvs mailing list