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

Side by Side Diff: content/common/sandbox_win.cc

Issue 1058373003: Adding minidump creation when launching renderer process fails in appcontainer mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.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/common/sandbox_win.h" 5 #include "content/common/sandbox_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/dump_without_crashing.h"
11 #include "base/debug/profiler.h" 12 #include "base/debug/profiler.h"
12 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
13 #include "base/hash.h" 14 #include "base/hash.h"
14 #include "base/metrics/sparse_histogram.h" 15 #include "base/metrics/sparse_histogram.h"
15 #include "base/path_service.h" 16 #include "base/path_service.h"
16 #include "base/process/launch.h" 17 #include "base/process/launch.h"
17 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
19 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
20 #include "base/win/iat_patch_function.h" 21 #include "base/win/iat_patch_function.h"
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 722 }
722 723
723 TRACE_EVENT_BEGIN_ETW("StartProcessWithAccess::LAUNCHPROCESS", 0, 0); 724 TRACE_EVENT_BEGIN_ETW("StartProcessWithAccess::LAUNCHPROCESS", 0, 0);
724 725
725 PROCESS_INFORMATION temp_process_info = {}; 726 PROCESS_INFORMATION temp_process_info = {};
726 result = g_broker_services->SpawnTarget( 727 result = g_broker_services->SpawnTarget(
727 cmd_line->GetProgram().value().c_str(), 728 cmd_line->GetProgram().value().c_str(),
728 cmd_line->GetCommandLineString().c_str(), 729 cmd_line->GetCommandLineString().c_str(),
729 policy, &temp_process_info); 730 policy, &temp_process_info);
730 DWORD last_error = ::GetLastError(); 731 DWORD last_error = ::GetLastError();
731 policy->Release();
732 base::win::ScopedProcessInformation target(temp_process_info); 732 base::win::ScopedProcessInformation target(temp_process_info);
733 733
734 TRACE_EVENT_END_ETW("StartProcessWithAccess::LAUNCHPROCESS", 0, 0); 734 TRACE_EVENT_END_ETW("StartProcessWithAccess::LAUNCHPROCESS", 0, 0);
735 735
736 if (sandbox::SBOX_ALL_OK != result) { 736 if (sandbox::SBOX_ALL_OK != result) {
737 if (result == sandbox::SBOX_ERROR_GENERIC) 737 if (result == sandbox::SBOX_ERROR_GENERIC)
738 DPLOG(ERROR) << "Failed to launch process"; 738 DPLOG(ERROR) << "Failed to launch process";
739 else if (result == sandbox::SBOX_ERROR_CREATE_PROCESS) { 739 else if (result == sandbox::SBOX_ERROR_CREATE_PROCESS) {
740 // TODO(shrikant): Remove this special case handling after determining 740 // TODO(shrikant): Remove this special case handling after determining
741 // cause for lowbox/createprocess errors. 741 // cause for lowbox/createprocess errors.
742 sandbox::PolicyBase* policy_base = 742 sandbox::PolicyBase* policy_base =
743 static_cast<sandbox::PolicyBase*>(policy); 743 static_cast<sandbox::PolicyBase*>(policy);
744 UMA_HISTOGRAM_SPARSE_SLOWLY(policy_base->GetLowBoxSid() ? 744 UMA_HISTOGRAM_SPARSE_SLOWLY(policy_base->GetLowBoxSid() ?
745 "Process.Sandbox.Lowbox.Launch.Error" : 745 "Process.Sandbox.Lowbox.Launch.Error" :
746 "Process.Sandbox.Launch.Error", 746 "Process.Sandbox.Launch.Error",
747 last_error); 747 last_error);
748 // Trigger a minidump without crashing the browser.
749 // Note that this function will only generate minidump if content host
750 // has already done pre-setup by calling
751 // base::debug::SetDumpWithoutCrashingFunction
752 base::debug::DumpWithoutCrashing();
748 } else 753 } else
749 DLOG(ERROR) << "Failed to launch process. Error: " << result; 754 DLOG(ERROR) << "Failed to launch process. Error: " << result;
755
756 policy->Release();
750 return base::Process(); 757 return base::Process();
751 } 758 }
759 policy->Release();
752 760
753 if (delegate) 761 if (delegate)
754 delegate->PostSpawnTarget(target.process_handle()); 762 delegate->PostSpawnTarget(target.process_handle());
755 763
756 CHECK(ResumeThread(target.thread_handle()) != -1); 764 CHECK(ResumeThread(target.thread_handle()) != -1);
757 TRACE_EVENT_END_ETW("StartProcessWithAccess", 0, type_str); 765 TRACE_EVENT_END_ETW("StartProcessWithAccess", 0, type_str);
758 return base::Process(target.TakeProcessHandle()); 766 return base::Process(target.TakeProcessHandle());
759 } 767 }
760 768
761 bool BrokerDuplicateHandle(HANDLE source_handle, 769 bool BrokerDuplicateHandle(HANDLE source_handle,
(...skipping 28 matching lines...) Expand all
790 } 798 }
791 799
792 return false; 800 return false;
793 } 801 }
794 802
795 bool BrokerAddTargetPeer(HANDLE peer_process) { 803 bool BrokerAddTargetPeer(HANDLE peer_process) {
796 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 804 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
797 } 805 }
798 806
799 } // namespace content 807 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698