diff options
author | Qian Hong <qhong@codeweavers.com> | 2015-10-29 09:17:46 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-10-29 09:17:57 +0100 |
commit | ff3c4a7d2fd686543140b0d39177c3464d1444e1 (patch) | |
tree | 2926e13e551a2fcb3be76e8a98338bdadf9e8212 /winsup/cygwin/init.cc | |
parent | e30d78d6850ccbed3bc4e108b4023de852ff884f (diff) | |
download | cygnal-ff3c4a7d2fd686543140b0d39177c3464d1444e1.tar.gz cygnal-ff3c4a7d2fd686543140b0d39177c3464d1444e1.tar.bz2 cygnal-ff3c4a7d2fd686543140b0d39177c3464d1444e1.zip |
Check for correct funtion entry address in munge_threadfunc
* init.cc (munge_threadfunc): Check that we're actually replacing
the correct original function address on the stack.
* ntdll.h (enum _THREADINFOCLASS): Add ThreadQuerySetWin32StartAddress.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/init.cc')
-rw-r--r-- | winsup/cygwin/init.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 56d466869..69e66a029 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -55,12 +55,17 @@ munge_threadfunc () if (threadfunc_ix[0]) { - char *threadfunc = ebp[threadfunc_ix[0]]; + char *threadfunc = NULL; + + NtQueryInformationThread (NtCurrentThread (), + ThreadQuerySetWin32StartAddress, + &threadfunc, sizeof threadfunc, NULL); if (!search_for || threadfunc == search_for) { search_for = NULL; for (i = 0; threadfunc_ix[i]; i++) - ebp[threadfunc_ix[i]] = (char *) threadfunc_fe; + if (!threadfunc || ebp[threadfunc_ix[i]] == threadfunc) + ebp[threadfunc_ix[i]] = (char *) threadfunc_fe; TlsSetValue (_my_oldfunc, threadfunc); } } |