diff options
author | rockot <rockot@chromium.org> | 2015-08-16 10:36:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-16 17:37:25 +0000 |
commit | 531d19bbe954ecd92d2027d2c4d0d6c850cfe0de (patch) | |
tree | a2befaa0937d12b8be4af8cfbc0609e23a53a7db /content | |
parent | d7996e64b1d86fa874e1f9b98563dedd5d4e3af5 (diff) | |
download | chromium_src-531d19bbe954ecd92d2027d2c4d0d6c850cfe0de.zip chromium_src-531d19bbe954ecd92d2027d2c4d0d6c850cfe0de.tar.gz chromium_src-531d19bbe954ecd92d2027d2c4d0d6c850cfe0de.tar.bz2 |
Revert of Print stack traces in child processes when browser tests failed. (patchset #5 id:80001 of https://codereview.chromium.org/1291553003/ )
Reason for revert:
This is unfortunately breaking Windows 10 in a major way. I did a local bisect and narrowed it down to this CL.
BUG=521242
Original issue's description:
> 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
>
> Committed: https://crrev.com/8ba532e170befc312e66d032587fa2ad04bac975
> Cr-Commit-Position: refs/heads/master@{#343240}
TBR=scottmg@chromium.org,jln@chromium.org,wfh@chromium.org,jam@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=517488,358267
Review URL: https://codereview.chromium.org/1299583002
Cr-Commit-Position: refs/heads/master@{#343603}
Diffstat (limited to 'content')
-rw-r--r-- | content/app/content_main_runner.cc | 10 | ||||
-rw-r--r-- | content/common/sandbox_win.cc | 4 | ||||
-rw-r--r-- | content/gpu/gpu_main.cc | 7 | ||||
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.cc | 6 | ||||
-rw-r--r-- | content/renderer/renderer_main.cc | 12 | ||||
-rw-r--r-- | content/renderer/renderer_main_platform_delegate_win.cc | 7 | ||||
-rw-r--r-- | content/utility/utility_main.cc | 6 |
7 files changed, 39 insertions, 13 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 55c6ac7..df069e8 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -10,7 +10,6 @@ #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" @@ -196,15 +195,6 @@ 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 f475db3..7627865 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 stack traces. -#if !defined(OFFICIAL_BUILD) + // Add the policy for read-only PDB file access for AddressSanitizer. +#if defined(ADDRESS_SANITIZER) 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 8606afe..7820638 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -540,6 +540,13 @@ 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 6b2dc12..d220244 100644 --- a/content/ppapi_plugin/ppapi_thread.cc +++ b/content/ppapi_plugin/ppapi_thread.cc @@ -404,6 +404,12 @@ 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 3a34300..2d82597 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc @@ -6,6 +6,7 @@ #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" @@ -183,8 +184,17 @@ 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 3cf583d..2d769e8 100644 --- a/content/renderer/renderer_main_platform_delegate_win.cc +++ b/content/renderer/renderer_main_platform_delegate_win.cc @@ -109,6 +109,13 @@ 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 60a5d27..742a476 100644 --- a/content/utility/utility_main.cc +++ b/content/utility/utility_main.cc @@ -47,6 +47,12 @@ 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. |