diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-19 01:36:21 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-19 01:36:21 +0000 |
commit | c4ed802942d46ce11a6d8728bb7b02110e6076a8 (patch) | |
tree | 2437201c6d79cefe4e1dc8d4526d51d40034d5e9 /base | |
parent | 8e3e6fd0003787bbf4041b2904581b36cefd5a8e (diff) | |
download | chromium_src-c4ed802942d46ce11a6d8728bb7b02110e6076a8.zip chromium_src-c4ed802942d46ce11a6d8728bb7b02110e6076a8.tar.gz chromium_src-c4ed802942d46ce11a6d8728bb7b02110e6076a8.tar.bz2 |
Cleanup code used to diagnose and fix bug 81449.
I think it is unlikely that CloseHandle was the function that was being hooked because it is called from so many other places without problems. I am assuming that TerminateProcess was being hooked. If the symptoms of 81449 return when this is landed, this patch can be reverted.
BUG=81449
Review URL: http://codereview.chromium.org/7624052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process_win.cc | 25 | ||||
-rw-r--r-- | base/task.h | 8 | ||||
-rw-r--r-- | base/threading/platform_thread_win.cc | 8 |
3 files changed, 6 insertions, 35 deletions
diff --git a/base/process_win.cc b/base/process_win.cc index 593bdd3..8b4c2b0 100644 --- a/base/process_win.cc +++ b/base/process_win.cc @@ -13,20 +13,10 @@ namespace base { void Process::Close() { if (!process_) return; + // Don't call CloseHandle on a pseudo-handle. - if (process_ != ::GetCurrentProcess()) { - // TODO(apatrick): Call NtCloseHandle directly, without going through the - // import table to determine if CloseHandle is being hooked. - // http://crbug.com/81449. - HMODULE module = GetModuleHandle(L"ntdll.dll"); - typedef UINT (WINAPI *CloseHandlePtr)(HANDLE handle); - CloseHandlePtr close_handle = reinterpret_cast<CloseHandlePtr>( - GetProcAddress(module, "NtClose")); - close_handle(process_); - - // It used to look like this: - // ::CloseHandle(process_); - } + if (process_ != ::GetCurrentProcess()) + ::CloseHandle(process_); process_ = NULL; } @@ -35,17 +25,14 @@ void Process::Terminate(int result_code) { if (!process_) return; - // TODO(apatrick): Call NtTerminateProcess directly, without going through the - // import table to determine if TerminateProcess is being hooked. - // http://crbug.com/81449. + // Call NtTerminateProcess directly, without going through the import table, + // which might have been hooked with a buggy replacement by third party + // software. http://crbug.com/81449. HMODULE module = GetModuleHandle(L"ntdll.dll"); typedef UINT (WINAPI *TerminateProcessPtr)(HANDLE handle, UINT code); TerminateProcessPtr terminate_process = reinterpret_cast<TerminateProcessPtr>( GetProcAddress(module, "NtTerminateProcess")); terminate_process(process_, result_code); - - // It used to look like this: - // ::TerminateProcess(process_, result_code); } bool Process::IsProcessBackgrounded() const { diff --git a/base/task.h b/base/task.h index b95d748..3ff0640 100644 --- a/base/task.h +++ b/base/task.h @@ -473,14 +473,6 @@ class RunnableFunction : public Task { } virtual void Run() { - // TODO(apatrick): Remove this ASAP. This ensures that the function pointer - // is available in minidumps for the purpose of diagnosing - // http://crbug.com/81449. - Function function = function_; - base::debug::Alias(&function); - Params params = params_; - base::debug::Alias(¶ms); - if (function_) DispatchToFunction(function_, params_); } diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc index f5c6176..d5e64c1 100644 --- a/base/threading/platform_thread_win.cc +++ b/base/threading/platform_thread_win.cc @@ -34,14 +34,6 @@ 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) |