diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 20:37:59 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 20:37:59 +0000 |
commit | fecbc6cac20962ff51d60d2a7726ce3be8f345e4 (patch) | |
tree | 17b433feb1ca9027e0915751ef7935d44a27b86d /base/process_util_win.cc | |
parent | 3492fc6d1534eec4418232349cdcd5d36c61a881 (diff) | |
download | chromium_src-fecbc6cac20962ff51d60d2a7726ce3be8f345e4.zip chromium_src-fecbc6cac20962ff51d60d2a7726ce3be8f345e4.tar.gz chromium_src-fecbc6cac20962ff51d60d2a7726ce3be8f345e4.tar.bz2 |
Simplify chrome_exe_main_*.cc, moving as much of the code out as possible. This is in preparation for moving the code in ChromeMain (and associated platform files) to a common place that can be used by both chrome and other embedders of content (i.e. content_shell). Included is a change to make the sandbox code not need an AtExitManager. This is necessary because content_shell would be just one exe, and we'd need to initialize the sandbox before calling ChromeMain, which is what would creat AtExitManager.I removed the code that printed the tcmalloc stacks in the OOM handler (i.e. r33993) under Windows. The issue is I wanted to move the OOM handling code to base to match the other platforms (in a long string of changes to make the startup code more sane, so I can share it with a browser built over content). When I tried moving the tcmalloc code to base, then I ran into a bunch of linker errors because a bunch of targets that depend on base don't depend on allocator. When I tried to add that to base, I ran into strange gyp errors (see patchset 2). I asked Jim/Eric and they said they don't use this data from dumps, and that most of the OOM minimdumps are in v8 heap anyways. When James get back, if he still uses this I can figure out how to put this back.BUG=90445
Review URL: http://codereview.chromium.org/7810005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_win.cc')
-rw-r--r-- | base/process_util_win.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/process_util_win.cc b/base/process_util_win.cc index 8a2eafe..315a68f 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -94,6 +94,15 @@ void AttachToConsole() { std::ios::sync_with_stdio(); } +void OnNoMemory() { + // Kill the process. This is important for security, since WebKit doesn't + // NULL-check many memory allocations. If a malloc fails, returns NULL, and + // the buffer is then used, it provides a handy mapping of memory starting at + // address 0 for an attacker to utilize. + __debugbreak(); + _exit(1); +} + } // namespace ProcessId GetCurrentProcId() { @@ -822,6 +831,10 @@ void EnableTerminationOnHeapCorruption() { HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); } +void EnableTerminationOnOutOfMemory() { + std::set_new_handler(&OnNoMemory); +} + bool EnableInProcessStackDumping() { // Add stack dumping support on exception on windows. Similar to OS_POSIX // signal() handling in process_util_posix.cc. |