diff options
author | finnur <finnur@chromium.org> | 2015-12-21 02:21:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-21 10:22:19 +0000 |
commit | 27add94454c6b70921fb0718b5dbbd77eae3c5ec (patch) | |
tree | 053ee567d5ca80babdc0591fcdc2b19be955f820 | |
parent | 60c2129819e18ab4ce9546b1b5ace64d6bbd1c9c (diff) | |
download | chromium_src-27add94454c6b70921fb0718b5dbbd77eae3c5ec.zip chromium_src-27add94454c6b70921fb0718b5dbbd77eae3c5ec.tar.gz chromium_src-27add94454c6b70921fb0718b5dbbd77eae3c5ec.tar.bz2 |
Revert of Allow IAT patches to fail when patching for Active Verifier. (patchset #3 id:40001 of https://codereview.chromium.org/1540723002/ )
Reason for revert:
Seems to consistently cause Win7 tests to fail.
Example log:
https://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%281%29/builds/44171/steps/base_unittests/logs/stdio
Original issue's description:
> Allow IAT patches to fail when patching for Active Verifier.
>
> Not all loaded modules import CloseHandle and DuplicateHandle so
> InstallHandleHooks was failing incorrectly and causing the Handle
> Verifier to be disabled.
>
> Also, continue to patch DuplicateHandle if a module happens to
> not import CloseHandle.
>
> BUG=570912
>
> Committed: https://crrev.com/c844be97c13fcf492149a21a0f3d9bf083c3c0d2
> Cr-Commit-Position: refs/heads/master@{#366322}
TBR=cpu@chromium.org,wfh@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=570912
Review URL: https://codereview.chromium.org/1542553002
Cr-Commit-Position: refs/heads/master@{#366362}
-rw-r--r-- | base/debug/close_handle_hook_win.cc | 20 | ||||
-rw-r--r-- | base/test/run_all_unittests.cc | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/base/debug/close_handle_hook_win.cc b/base/debug/close_handle_hook_win.cc index 70d40b2..359b758 100644 --- a/base/debug/close_handle_hook_win.cc +++ b/base/debug/close_handle_hook_win.cc @@ -203,14 +203,15 @@ bool HandleHooks::AddIATPatch(HMODULE module) { base::win::IATPatchFunction* patch = NULL; patch = IATPatch(module, "CloseHandle", &CloseHandleHook, reinterpret_cast<void**>(&g_close_function)); - if (patch) - hooks_.push_back(patch); + if (!patch) + return false; + hooks_.push_back(patch); patch = IATPatch(module, "DuplicateHandle", &DuplicateHandleHook, reinterpret_cast<void**>(&g_duplicate_function)); - if (patch) - hooks_.push_back(patch); - + if (!patch) + return false; + hooks_.push_back(patch); return true; } @@ -248,12 +249,15 @@ bool PatchLoadedModules(HandleHooks* hooks) { returned /= sizeof(HMODULE); returned = std::min(kSize, returned); + bool success = false; + for (DWORD current = 0; current < returned; current++) { - if (!hooks->AddIATPatch(modules[current])) - return false; + success = hooks->AddIATPatch(modules[current]); + if (!success) + break; } - return true; + return success; } } // namespace diff --git a/base/test/run_all_unittests.cc b/base/test/run_all_unittests.cc index f3fb3d1..84e6d3f 100644 --- a/base/test/run_all_unittests.cc +++ b/base/test/run_all_unittests.cc @@ -22,7 +22,7 @@ int main(int argc, char** argv) { #endif base::TestSuite test_suite(argc, argv); #if defined(OS_WIN) - CHECK(base::debug::InstallHandleHooks()); + base::debug::InstallHandleHooks(); #endif int ret = base::LaunchUnitTests( argc, argv, |