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

commit 1d97f8aa43851df24c88c1d3f32071b1c16f0e0d
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Mon Mar 10 21:41:58 2025 +0100
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Mon Mar 10 21:41:58 2025 +0100

    Cygwin: signals: don't evaluate SA_SIGINFO context after handler returns
    
    After return from a signal handler created with the SA_SIGINFO flag,
    Cygwin checks if the handler changed the context.  If so, Cygwin
    erroneously uses the context in a call to setcontext().
    
    Drop this special behaviour.  Neither Linux man pages, nor POSIX
    documentation treat the context pointer given to the handler as
    anything other than a read-only area.
    
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/exceptions.cc | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index fe56e858727b..a05883e3fc4f 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1850,14 +1850,6 @@ _cygtls::call_signal_handler ()
                                        ? context.uc_sigmask : this_oldmask);
       if (this_errno >= 0)
        set_errno (this_errno);
-      if (this_sa_flags & SA_SIGINFO)
-       {
-         /* If more than just the sigmask in the context has been changed by
-            the signal handler, call setcontext. */
-         context_copy.uc_sigmask = context.uc_sigmask;
-         if (memcmp (&context, &context_copy, sizeof context) != 0)
-           setcontext (&context);
-       }
     }
 
   /* FIXME: Since 2011 this return statement always returned 1 (meaning

Reply via email to