https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9a5abcc896bde48ae72fd62fe43a2307663d8ad5
commit 9a5abcc896bde48ae72fd62fe43a2307663d8ad5 Author: Corinna Vinschen <[email protected]> Date: Wed Jan 30 20:05:39 2019 +0100 Cygwin: x86_64: pthreads: Install exception handler after switching stack After creating a pthread, the stack gets moved to the desired memory location. While the 32 bit thread wrapper copies the exception handler information to the new stack (so we have at least *some* exception handler present), the x86_64 code didn't perform any exception handler magic. Fix that. Signed-off-by: Corinna Vinschen <[email protected]> Diff: --- winsup/cygwin/thread.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index c7b7e51..f353dd4 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -30,6 +30,7 @@ details. */ #include "cygheap.h" #include "ntdll.h" #include "cygwait.h" +#include "exception.h" extern "C" void __fp_lock_all (); extern "C" void __fp_unlock_all (); @@ -1990,6 +1991,7 @@ pthread_spinlock::unlock () DWORD WINAPI pthread::thread_init_wrapper (void *arg) { + exception protect; pthread *thread = (pthread *) arg; /* This *must* be set prior to calling set_tls_self_pointer or there is a race with the signal processing code which may miss the signal mask
