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

commit 9c34e029918d482eef9fb4305530cb581f42dbe6
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Thu Dec 5 18:34:02 2024 +0100
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Fri Dec 6 11:43:17 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 <[email protected]>
    (cherry picked from commit 96d856320a1d740546eaf8a6c0ddb3d489e10492)

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

diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index e02d3503cc75..bbd5f27413aa 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -322,7 +322,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

Reply via email to