diff options
author | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-05 18:00:31 +0000 |
---|---|---|
committer | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-05 18:00:31 +0000 |
commit | 34788c95a9d38918ce6c45973462cebc42ced951 (patch) | |
tree | 7f7bf558a5a6efd6bc19550907c3456a45dd185b /sandbox/win | |
parent | 2e07b2c9e98fa8efe86cedf0844ecec28432b1b5 (diff) | |
download | chromium_src-34788c95a9d38918ce6c45973462cebc42ced951.zip chromium_src-34788c95a9d38918ce6c45973462cebc42ced951.tar.gz chromium_src-34788c95a9d38918ce6c45973462cebc42ced951.tar.bz2 |
Revert 160252 - Make mitigation failures CHECK
This is a temporary change to narrow down failures enabling mitigations on Win8. I'll revert once the cause is determined.
BUG=153399
Review URL: https://codereview.chromium.org/11040046
TBR=jschuh@chromium.org
Review URL: https://codereview.chromium.org/11026071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/win')
-rw-r--r-- | sandbox/win/src/process_mitigations.cc | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/sandbox/win/src/process_mitigations.cc b/sandbox/win/src/process_mitigations.cc index be4efe5..f569479 100644 --- a/sandbox/win/src/process_mitigations.cc +++ b/sandbox/win/src/process_mitigations.cc @@ -4,7 +4,6 @@ #include "sandbox/win/src/process_mitigations.h" -#include "base/logging.h" #include "base/win/windows_version.h" #include "sandbox/win/src/nt_internals.h" #include "sandbox/win/src/sandbox_utils.h" @@ -46,8 +45,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { // Check for SetDefaultDllDirectories since it requires KB2533623. if (set_default_dll_directories) { - if (!set_default_dll_directories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + if (!set_default_dll_directories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS) && + ERROR_ACCESS_DENIED != ::GetLastError()) { + return false; } } } @@ -56,8 +56,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { if (version >= base::win::VERSION_VISTA && (flags & MITIGATION_HEAP_TERMINATE)) { if (!::HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, - NULL, 0)) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + NULL, 0) && + ERROR_ACCESS_DENIED != ::GetLastError()) { + return false; } } @@ -74,8 +75,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { reinterpret_cast<SetProcessDEPPolicyFunction>( ::GetProcAddress(module, "SetProcessDEPPolicy")); if (set_process_dep_policy) { - if (!set_process_dep_policy(dep_flags) && return_on_fail) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + if (!set_process_dep_policy(dep_flags) && + ERROR_ACCESS_DENIED != ::GetLastError() && return_on_fail) { + return false; } } else { // We're on XP sp2, so use the less standard approach. @@ -96,8 +98,8 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { if (!SUCCEEDED(set_information_process(GetCurrentProcess(), ProcessExecuteFlags, &dep, sizeof(dep))) && - return_on_fail) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + ERROR_ACCESS_DENIED != ::GetLastError() && return_on_fail) { + return false; } } } @@ -122,8 +124,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { MITIGATION_RELOCATE_IMAGE_REQUIRED; if (!set_process_mitigation_policy(ProcessASLRPolicy, &policy, - sizeof(policy))) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + sizeof(policy)) && + ERROR_ACCESS_DENIED != ::GetLastError()) { + return false; } } @@ -134,8 +137,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { policy.RaiseExceptionOnInvalidHandleReference = true; if (!set_process_mitigation_policy(ProcessStrictHandleCheckPolicy, &policy, - sizeof(policy))) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + sizeof(policy)) && + ERROR_ACCESS_DENIED != ::GetLastError()) { + return false; } } @@ -145,8 +149,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { policy.DisallowWin32kSystemCalls = true; if (!set_process_mitigation_policy(ProcessSystemCallDisablePolicy, &policy, - sizeof(policy))) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + sizeof(policy)) && + ERROR_ACCESS_DENIED != ::GetLastError()) { + return false; } } @@ -156,8 +161,9 @@ bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { policy.DisableExtensionPoints = true; if (!set_process_mitigation_policy(ProcessExtensionPointDisablePolicy, - &policy, sizeof(policy))) { - CHECK_EQ(ERROR_ACCESS_DENIED, static_cast<long>(::GetLastError())); + &policy, sizeof(policy)) && + ERROR_ACCESS_DENIED != ::GetLastError()) { + return false; } } |