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

Side by Side Diff: content/renderer/renderer_main_platform_delegate_win.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/renderer_main_platform_delegate.h" 5 #include "content/renderer/renderer_main_platform_delegate.h"
6 6
7 #include <signal.h>
8
9 #include "base/command_line.h" 7 #include "base/command_line.h"
10 #include "base/logging.h" 8 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
12 #include "base/string16.h" 10 #include "base/string16.h"
13 #include "base/win/win_util.h" 11 #include "base/win/win_util.h"
14 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
15 #include "content/public/common/injection_test_win.h" 13 #include "content/public/common/injection_test_win.h"
16 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
17 #include "content/renderer/render_thread_impl.h" 15 #include "content/renderer/render_thread_impl.h"
18 #include "sandbox/win/src/sandbox.h" 16 #include "sandbox/win/src/sandbox.h"
(...skipping 16 matching lines...) Expand all
35 const wchar_t* text, 33 const wchar_t* text,
36 unsigned int text_length) { 34 unsigned int text_length) {
37 content::RenderThreadImpl* render_thread_impl = 35 content::RenderThreadImpl* render_thread_impl =
38 content::RenderThreadImpl::current(); 36 content::RenderThreadImpl::current();
39 if (render_thread_impl) { 37 if (render_thread_impl) {
40 render_thread_impl->PreCacheFontCharacters(logfont, 38 render_thread_impl->PreCacheFontCharacters(logfont,
41 string16(text, text_length)); 39 string16(text, text_length));
42 } 40 }
43 } 41 }
44 42
45 void __cdecl ForceCrashOnSigAbort(int) {
46 *((int*)0) = 0x1337;
47 }
48
49 void InitExitInterceptions() { 43 void InitExitInterceptions() {
50 // If code subsequently tries to exit using exit(), _exit(), abort(), or 44 // If code subsequently tries to exit using exit(), _exit(), abort(), or
51 // ExitProcess(), force a crash (since otherwise these would be silent 45 // ExitProcess(), force a crash (since otherwise these would be silent
52 // terminations and fly under the radar). 46 // terminations and fly under the radar).
53 base::win::SetShouldCrashOnProcessDetach(true); 47 base::win::SetShouldCrashOnProcessDetach(true);
54 48 base::win::SetAbortBehaviorForCrashReporting();
55 // Prevent CRT's abort code from prompting a dialog or trying to "report" it.
56 // Disabling the _CALL_REPORTFAULT behavior is important since otherwise it
57 // has the sideffect of clearing our exception filter, which means we
58 // don't get any crash.
59 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
60
61 // Set a SIGABRT handler for good measure. We will crash even if the default
62 // is left in place, however this allows us to crash earlier. And it also
63 // lets us crash in response to code which might directly call raise(SIGABRT)
64 signal(SIGABRT, ForceCrashOnSigAbort);
65 } 49 }
66 50
67 } // namespace 51 } // namespace
68 52
69 RendererMainPlatformDelegate::RendererMainPlatformDelegate( 53 RendererMainPlatformDelegate::RendererMainPlatformDelegate(
70 const MainFunctionParams& parameters) 54 const MainFunctionParams& parameters)
71 : parameters_(parameters), 55 : parameters_(parameters),
72 sandbox_test_module_(NULL) { 56 sandbox_test_module_(NULL) {
73 } 57 }
74 58
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (run_security_tests) { 136 if (run_security_tests) {
153 int test_count = 0; 137 int test_count = 0;
154 DVLOG(1) << "Running renderer security tests"; 138 DVLOG(1) << "Running renderer security tests";
155 BOOL result = run_security_tests(&test_count); 139 BOOL result = run_security_tests(&test_count);
156 CHECK(result) << "Test number " << test_count << " has failed."; 140 CHECK(result) << "Test number " << test_count << " has failed.";
157 } 141 }
158 } 142 }
159 } 143 }
160 144
161 } // namespace content 145 } // namespace content
OLDNEW
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698