From d03f429727e0e61fad4b52c9bc94011b85ef7b21 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 12 Nov 2015 11:48:30 +0100 Subject: [PATCH] Fix crash at process init on 64 bit XP/2003 under WOW64 * init.cc (munge_threadfunc): Don't call NtQueryInformationThread with ThreadQuerySetWin32StartAddress info class on XP 64 and Server 2003 64. It crashes. Signed-off-by: Corinna Vinschen --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/init.cc | 9 ++++++--- winsup/cygwin/release/2.3.1 | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 winsup/cygwin/release/2.3.1 diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0e96d150e..8e40c2f31 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2015-11-12 Corinna Vinschen + + * init.cc (munge_threadfunc): Don't call NtQueryInformationThread with + ThreadQuerySetWin32StartAddress info class on XP 64 and Server 2003 64. + It crashes. + 2015-11-09 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 1. diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 69e66a029..c6f0e3de9 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -57,9 +57,12 @@ munge_threadfunc () { char *threadfunc = NULL; - NtQueryInformationThread (NtCurrentThread (), - ThreadQuerySetWin32StartAddress, - &threadfunc, sizeof threadfunc, NULL); + if (wincap.wow64_has_secondary_stack ()) + threadfunc = ebp[threadfunc_ix[0]]; + else + NtQueryInformationThread (NtCurrentThread (), + ThreadQuerySetWin32StartAddress, + &threadfunc, sizeof threadfunc, NULL); if (!search_for || threadfunc == search_for) { search_for = NULL; diff --git a/winsup/cygwin/release/2.3.1 b/winsup/cygwin/release/2.3.1 new file mode 100644 index 000000000..5299d2304 --- /dev/null +++ b/winsup/cygwin/release/2.3.1 @@ -0,0 +1,14 @@ +What's new: +----------- + + +What changed: +------------- + + +Bug Fixes +--------- + +- The fix for wine introduced in 2.3.0 crashes in 32 bit Cygwin on 64 bit XP + and 64 bit Server 2003 only. This should work now. + Addresses: https://cygwin.com/ml/cygwin/2015-11/msg00187.html