diff options
Diffstat (limited to 'chromium/base/process')
-rw-r--r-- | chromium/base/process/kill.h | 7 | ||||
-rw-r--r-- | chromium/base/process/kill_win.cc | 6 | ||||
-rw-r--r-- | chromium/base/process/launch_win.cc | 8 | ||||
-rw-r--r-- | chromium/base/process/process_unittest.cc | 16 |
4 files changed, 19 insertions, 18 deletions
diff --git a/chromium/base/process/kill.h b/chromium/base/process/kill.h index 9acfb8a7388..70a04d97e5a 100644 --- a/chromium/base/process/kill.h +++ b/chromium/base/process/kill.h @@ -29,6 +29,7 @@ const DWORD kNormalTerminationExitCode = 0; const DWORD kDebuggerInactiveExitCode = 0xC0000354; const DWORD kKeyboardInterruptExitCode = 0xC000013A; const DWORD kDebuggerTerminatedExitCode = 0x40010004; +const DWORD kStatusInvalidImageHashExitCode = 0xC0000428; // This exit code is used by the Windows task manager when it kills a // process. It's value is obviously not that unique, and it's @@ -46,6 +47,7 @@ const DWORD kProcessKilledExitCode = 1; // exit code arguments to KillProcess*(), use platform/application // specific values instead. enum TerminationStatus { + // clang-format off TERMINATION_STATUS_NORMAL_TERMINATION, // zero exit status TERMINATION_STATUS_ABNORMAL_TERMINATION, // non-zero exit status TERMINATION_STATUS_PROCESS_WAS_KILLED, // e.g. SIGKILL or task manager kill @@ -64,7 +66,12 @@ enum TerminationStatus { #endif TERMINATION_STATUS_LAUNCH_FAILED, // child process never launched TERMINATION_STATUS_OOM, // Process died due to oom +#if defined(OS_WIN) + // On Windows, the OS terminated process due to code integrity failure. + TERMINATION_STATUS_INTEGRITY_FAILURE, +#endif TERMINATION_STATUS_MAX_ENUM + // clang-format on }; // Attempts to kill all the processes on the current machine that were launched diff --git a/chromium/base/process/kill_win.cc b/chromium/base/process/kill_win.cc index 7a664429bcd..3b85dea1cd4 100644 --- a/chromium/base/process/kill_win.cc +++ b/chromium/base/process/kill_win.cc @@ -61,6 +61,7 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) { *exit_code = tmp_exit_code; + // clang-format off switch (tmp_exit_code) { case win::kNormalTerminationExitCode: return TERMINATION_STATUS_NORMAL_TERMINATION; @@ -74,10 +75,15 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) { // object memory limits. case win::kOomExceptionCode: // Ran out of memory. return TERMINATION_STATUS_OOM; + // This exit code means the process failed an OS integrity check. + // This is tested in ProcessMitigationsTest.* in sandbox. + case win::kStatusInvalidImageHashExitCode: + return TERMINATION_STATUS_INTEGRITY_FAILURE; default: // All other exit codes indicate crashes. return TERMINATION_STATUS_PROCESS_CRASHED; } + // clang-format on } bool WaitForProcessesToExit(const FilePath::StringType& executable_name, diff --git a/chromium/base/process/launch_win.cc b/chromium/base/process/launch_win.cc index 6bf9e188d66..59c4e8f7e27 100644 --- a/chromium/base/process/launch_win.cc +++ b/chromium/base/process/launch_win.cc @@ -287,9 +287,9 @@ Process LaunchProcess(const string16& cmdline, << "job. https://crbug.com/820996"; if (options.as_user) { flags |= CREATE_UNICODE_ENVIRONMENT; - void* enviroment_block = nullptr; + void* environment_block = nullptr; - if (!CreateEnvironmentBlock(&enviroment_block, options.as_user, FALSE)) { + if (!CreateEnvironmentBlock(&environment_block, options.as_user, FALSE)) { DPLOG(ERROR); return Process(); } @@ -300,9 +300,9 @@ Process LaunchProcess(const string16& cmdline, BOOL launched = CreateProcessAsUser( options.as_user, nullptr, as_writable_wcstr(writable_cmdline), nullptr, - nullptr, inherit_handles, flags, enviroment_block, current_directory, + nullptr, inherit_handles, flags, environment_block, current_directory, startup_info, &temp_process_info); - DestroyEnvironmentBlock(enviroment_block); + DestroyEnvironmentBlock(environment_block); if (!launched) { DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline) << std::endl; diff --git a/chromium/base/process/process_unittest.cc b/chromium/base/process/process_unittest.cc index 68126460557..18db6892399 100644 --- a/chromium/base/process/process_unittest.cc +++ b/chromium/base/process/process_unittest.cc @@ -271,13 +271,7 @@ TEST_F(ProcessTest, WaitForExitWithTimeout) { // backgrounding and restoring. // Note: a platform may not be willing or able to lower the priority of // a process. The calls to SetProcessBackground should be noops then. -// Flaky on Windows: https://crbug.com/931721. -#if defined(OS_WIN) -#define MAYBE_SetProcessBackgrounded DISABLED_SetProcessBackgrounded -#else -#define MAYBE_SetProcessBackgrounded SetProcessBackgrounded -#endif -TEST_F(ProcessTest, MAYBE_SetProcessBackgrounded) { +TEST_F(ProcessTest, SetProcessBackgrounded) { if (!Process::CanBackgroundProcesses()) return; Process process(SpawnChild("SimpleChildProcess")); @@ -305,15 +299,9 @@ TEST_F(ProcessTest, MAYBE_SetProcessBackgrounded) { EXPECT_EQ(old_priority, new_priority); } -// Flaky on Windows: https://crbug.com/931721. -#if defined(OS_WIN) -#define MAYBE_SetProcessBackgroundedSelf DISABLED_SetProcessBackgroundedSelf -#else -#define MAYBE_SetProcessBackgroundedSelf SetProcessBackgroundedSelf -#endif // Same as SetProcessBackgrounded but to this very process. It uses // a different code path at least for Windows. -TEST_F(ProcessTest, MAYBE_SetProcessBackgroundedSelf) { +TEST_F(ProcessTest, SetProcessBackgroundedSelf) { if (!Process::CanBackgroundProcesses()) return; Process process = Process::Current(); |