diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 00:05:23 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 00:05:23 +0000 |
commit | ef06bb6063e6b5b0f041ebbb8e28b1e51d2b02c4 (patch) | |
tree | 161dc806c7db7358d01f2be2e6a2931de904c6bc /base/threading | |
parent | 33ef938e3328fa4a054a9f4261cfeb3430f2f6bf (diff) | |
download | chromium_src-ef06bb6063e6b5b0f041ebbb8e28b1e51d2b02c4.zip chromium_src-ef06bb6063e6b5b0f041ebbb8e28b1e51d2b02c4.tar.gz chromium_src-ef06bb6063e6b5b0f041ebbb8e28b1e51d2b02c4.tar.bz2 |
Added code to verify whether TerminateProcess is hooked before calling it.
This is to diagnose the bug referenced below. I think it is possible that a third party DLL is hooking TerminateProcess with a replacement that uses the wrong calling convention or has the wrong number of arguments, which causes Process::Terminate to return to the wrong address, causing a crash.
I put it in ThreadFunc because this is visible on the stack when the crash happens and because it is a windows specific .cc file.
BUG=81449
Review URL: http://codereview.chromium.org/7606016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading')
-rw-r--r-- | base/threading/platform_thread_win.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc index e2d90d8..f5c6176 100644 --- a/base/threading/platform_thread_win.cc +++ b/base/threading/platform_thread_win.cc @@ -4,6 +4,7 @@ #include "base/threading/platform_thread.h" +#include "base/debug/alias.h" #include "base/logging.h" #include "base/threading/thread_local.h" #include "base/threading/thread_restrictions.h" @@ -33,6 +34,14 @@ struct ThreadParams { }; DWORD __stdcall ThreadFunc(void* params) { + // TODO(apatrick): Remove this ASAP. This ensures that if the + // TerminateProcess entry point has been patched to point into a third party + // DLL, this is visible on the stack and the DLL in question can be + // determined. + typedef BOOL (WINAPI *TerminateProcessPtr)(HANDLE, UINT); + TerminateProcessPtr terminate_process = TerminateProcess; + base::debug::Alias(&terminate_process); + ThreadParams* thread_params = static_cast<ThreadParams*>(params); PlatformThread::Delegate* delegate = thread_params->delegate; if (!thread_params->joinable) |