summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-08-13 11:30:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-13 18:31:03 +0000
commit8ba532e170befc312e66d032587fa2ad04bac975 (patch)
tree5804cef67958f109ab4d0bc4781a8656126b4ea2 /content
parentc040432a33591da9dcaf2cabf391893353f0107a (diff)
downloadchromium_src-8ba532e170befc312e66d032587fa2ad04bac975.zip
chromium_src-8ba532e170befc312e66d032587fa2ad04bac975.tar.gz
chromium_src-8ba532e170befc312e66d032587fa2ad04bac975.tar.bz2
Print stack traces in child processes when browser tests failed.
The functionality to do this opens up security holes. Currently this was working only for debug Linux builds. However our trybots are release builds, and we need to be able to see stack traces from child processes on all platforms (i.e. to be able to debug the large flakiness that occurred since last week). This is disabled for official builds. BUG=517488,358267 Review URL: https://codereview.chromium.org/1291553003 Cr-Commit-Position: refs/heads/master@{#343240}
Diffstat (limited to 'content')
-rw-r--r--content/app/content_main_runner.cc10
-rw-r--r--content/common/sandbox_win.cc4
-rw-r--r--content/gpu/gpu_main.cc7
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc6
-rw-r--r--content/renderer/renderer_main.cc12
-rw-r--r--content/renderer/renderer_main_platform_delegate_win.cc7
-rw-r--r--content/utility/utility_main.cc6
7 files changed, 13 insertions, 39 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index df069e8..55c6ac7 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -10,6 +10,7 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/debug/debugger.h"
+#include "base/debug/stack_trace.h"
#include "base/files/file_path.h"
#include "base/i18n/icu_util.h"
#include "base/lazy_instance.h"
@@ -195,6 +196,15 @@ void CommonSubprocessInit(const std::string& process_type) {
// surface UI -- but it's likely they get this wrong too so why not.
setlocale(LC_NUMERIC, "C");
#endif
+
+#if !defined(OFFICIAL_BUILD)
+ // Print stack traces to stderr when crashes occur. This opens up security
+ // holes so it should never be enabled for official builds.
+ base::debug::EnableInProcessStackDumping();
+#if defined(OS_WIN)
+ LoadLibraryA("dbghelp.dll");
+#endif
+#endif
}
class ContentClientInitializer {
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index 7627865..f475db3 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -328,8 +328,8 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) {
return false;
#endif // NDEBUG
- // Add the policy for read-only PDB file access for AddressSanitizer.
-#if defined(ADDRESS_SANITIZER)
+ // Add the policy for read-only PDB file access for stack traces.
+#if !defined(OFFICIAL_BUILD)
base::FilePath exe;
if (!PathService::Get(base::FILE_EXE, &exe))
return false;
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index 7820638..8606afe 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -540,13 +540,6 @@ bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo* sandbox_info) {
// content.
sandbox::TargetServices* target_services = sandbox_info->target_services;
if (target_services) {
-#if defined(ADDRESS_SANITIZER)
- // Bind and leak dbghelp.dll before the token is lowered, otherwise
- // AddressSanitizer will crash when trying to symbolize a report.
- if (!LoadLibraryA("dbghelp.dll"))
- return false;
-#endif
-
target_services->LowerToken();
return true;
}
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index d220244..6b2dc12 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -404,12 +404,6 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
WarmupWindowsLocales(permissions);
-#if defined(ADDRESS_SANITIZER)
- // Bind and leak dbghelp.dll before the token is lowered, otherwise
- // AddressSanitizer will crash when trying to symbolize a report.
- LoadLibraryA("dbghelp.dll");
-#endif
-
g_target_services->LowerToken();
}
#endif
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index 2d82597..3a34300 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -6,7 +6,6 @@
#include "base/command_line.h"
#include "base/debug/debugger.h"
#include "base/debug/leak_annotations.h"
-#include "base/debug/stack_trace.h"
#include "base/i18n/rtl.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
@@ -184,17 +183,8 @@ int RendererMain(const MainFunctionParams& parameters) {
renderer_scheduler.Pass());
#endif
bool run_loop = true;
- if (!no_sandbox) {
+ if (!no_sandbox)
run_loop = platform.EnableSandbox();
- } else {
- LOG(ERROR) << "Running without renderer sandbox";
-#if !defined(NDEBUG) || (defined(CFI_ENFORCEMENT) && !defined(OFFICIAL_BUILD))
- // For convenience, we print the stack traces for crashes. When sandbox
- // is enabled, the in-process stack dumping is enabled as part of the
- // EnableSandbox() call.
- base::debug::EnableInProcessStackDumping();
-#endif
- }
#if defined(OS_POSIX) && !defined(OS_MACOSX)
RenderProcessImpl render_process;
RenderThreadImpl::Create(main_message_loop.Pass(),
diff --git a/content/renderer/renderer_main_platform_delegate_win.cc b/content/renderer/renderer_main_platform_delegate_win.cc
index 2d769e8..3cf583d 100644
--- a/content/renderer/renderer_main_platform_delegate_win.cc
+++ b/content/renderer/renderer_main_platform_delegate_win.cc
@@ -109,13 +109,6 @@ bool RendererMainPlatformDelegate::EnableSandbox() {
::GetUserDefaultLangID();
::GetUserDefaultLCID();
-#if defined(ADDRESS_SANITIZER)
- // Bind and leak dbghelp.dll before the token is lowered, otherwise
- // AddressSanitizer will crash when trying to symbolize a report.
- if (!LoadLibraryA("dbghelp.dll"))
- return false;
-#endif
-
target_services->LowerToken();
return true;
}
diff --git a/content/utility/utility_main.cc b/content/utility/utility_main.cc
index 742a476..60a5d27 100644
--- a/content/utility/utility_main.cc
+++ b/content/utility/utility_main.cc
@@ -47,12 +47,6 @@ int UtilityMain(const MainFunctionParams& parameters) {
parameters.sandbox_info->target_services;
if (!target_services)
return false;
-#if defined(ADDRESS_SANITIZER)
- // Bind and leak dbghelp.dll before the token is lowered, otherwise
- // AddressSanitizer will crash when trying to symbolize a report.
- if (!LoadLibraryA("dbghelp.dll"))
- return false;
-#endif
char buffer;
// Ensure RtlGenRandom is warm before the token is lowered; otherwise,
// base::RandBytes() will CHECK fail when v8 is initialized.