Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2891)

Unified Diff: base/win/win_util.cc

Issue 11565026: Crash ppapi processes on Windows when calling exit(), _exit(), abort() and ExitProcess() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/win_util.h ('k') | content/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/win_util.cc
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 3b6b1761ed3199ab34008fde4e1f584a72da9cea..b885d6ea7bd9d0e15275f5a55c6a56ee4b846f0f 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -11,6 +11,8 @@
#include <propvarutil.h>
#include <sddl.h>
#include <shlobj.h>
+#include <signal.h>
+#include <stdlib.h>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -39,6 +41,10 @@ bool SetPropVariantValueForPropertyStore(
return SUCCEEDED(result);
}
+void __cdecl ForceCrashOnSigAbort(int) {
+ *((int*)0) = 0x1337;
+}
+
} // namespace
namespace base {
@@ -186,6 +192,19 @@ bool ShouldCrashOnProcessDetach() {
return g_crash_on_process_detach;
}
+void SetAbortBehaviorForCrashReporting() {
+ // Prevent CRT's abort code from prompting a dialog or trying to "report" it.
+ // Disabling the _CALL_REPORTFAULT behavior is important since otherwise it
+ // has the sideffect of clearing our exception filter, which means we
+ // don't get any crash.
+ _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
+
+ // Set a SIGABRT handler for good measure. We will crash even if the default
+ // is left in place, however this allows us to crash earlier. And it also
+ // lets us crash in response to code which might directly call raise(SIGABRT)
+ signal(SIGABRT, ForceCrashOnSigAbort);
+}
+
bool IsMachineATablet() {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return false;
« no previous file with comments | « base/win/win_util.h ('k') | content/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698