Commit 9428d096 authored by wfh's avatar wfh Committed by Commit bot

Consume EXCEPTION_INVALID_HANDLE on sandbox process shutdown.

BUG=452613

Review URL: https://codereview.chromium.org/944283002

Cr-Commit-Position: refs/heads/master@{#318204}
parent 37fd293f
...@@ -235,7 +235,14 @@ int MainDllLoader::Launch(HINSTANCE instance) { ...@@ -235,7 +235,14 @@ int MainDllLoader::Launch(HINSTANCE instance) {
DLL_MAIN chrome_main = DLL_MAIN chrome_main =
reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain"));
int rc = chrome_main(instance, &sandbox_info); int rc = chrome_main(instance, &sandbox_info);
return OnBeforeExit(rc, file); rc = OnBeforeExit(rc, file);
// Sandboxed processes close some system DLL handles after lockdown so ignore
// EXCEPTION_INVALID_HANDLE generated on Windows 10 during shutdown of these
// processes.
// TODO(wfh): Check whether MS have fixed this in Win10 RTM. crbug.com/456193
if (base::win::GetVersion() >= base::win::VERSION_WIN10)
breakpad::ConsumeInvalidHandleExceptions();
return rc;
} }
void MainDllLoader::RelaunchChromeBrowserWithNewCommandLineIfNeeded() { void MainDllLoader::RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
......
...@@ -616,6 +616,15 @@ void InitCrashReporter(const std::string& process_type_switch) { ...@@ -616,6 +616,15 @@ void InitCrashReporter(const std::string& process_type_switch) {
} }
} }
void ConsumeInvalidHandleExceptions() {
if (g_breakpad) {
g_breakpad->set_consume_invalid_handle_exceptions(true);
}
if (g_dumphandler_no_crash) {
g_dumphandler_no_crash->set_consume_invalid_handle_exceptions(true);
}
}
// If the user has disabled crash reporting uploads and restarted Chrome, the // If the user has disabled crash reporting uploads and restarted Chrome, the
// restarted instance will still contain the pipe environment variable, which // restarted instance will still contain the pipe environment variable, which
// will allow the restarted process to still upload crash reports. This function // will allow the restarted process to still upload crash reports. This function
......
...@@ -17,6 +17,12 @@ void InitCrashReporter(const std::string& process_type_switch); ...@@ -17,6 +17,12 @@ void InitCrashReporter(const std::string& process_type_switch);
// a dialog asking for permission to continue execution or to exit now. // a dialog asking for permission to continue execution or to exit now.
bool ShowRestartDialogIfCrashed(bool* exit_now); bool ShowRestartDialogIfCrashed(bool* exit_now);
// Tells Breakpad that our process is shutting down and to consume
// EXCEPTION_INVALID_HANDLE exceptions which occur if bad handle detection is
// enabled and the sandbox handle closer has previously closed handles owned by
// Windows DLLs.
void ConsumeInvalidHandleExceptions();
} // namespace breakpad } // namespace breakpad
#endif // COMPONENTS_CRASH_APP_BREAKPAD_WIN_H_ #endif // COMPONENTS_CRASH_APP_BREAKPAD_WIN_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment