OLD | NEW |
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" |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 policy, &temp_process_info); | 729 policy, &temp_process_info); |
730 DWORD last_error = ::GetLastError(); | 730 DWORD last_error = ::GetLastError(); |
731 policy->Release(); | 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 | 739 else if (result == sandbox::SBOX_ERROR_CREATE_PROCESS) { |
| 740 // TODO(shrikant): Remove this special case handling after determining |
| 741 // cause for lowbox/createprocess errors. |
| 742 sandbox::PolicyBase* policy_base = |
| 743 static_cast<sandbox::PolicyBase*>(policy); |
| 744 if (policy_base->GetLowBoxSid()) { |
| 745 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Lowbox.Launch.Error", |
| 746 last_error); |
| 747 } |
| 748 } else |
740 DLOG(ERROR) << "Failed to launch process. Error: " << result; | 749 DLOG(ERROR) << "Failed to launch process. Error: " << result; |
741 | |
742 sandbox::PolicyBase* policy_base = | |
743 static_cast<sandbox::PolicyBase*>(policy); | |
744 if (policy_base->GetLowBoxSid()) { | |
745 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Lowbox.Launch.Error", | |
746 last_error); | |
747 } | |
748 return base::Process(); | 750 return base::Process(); |
749 } | 751 } |
750 | 752 |
751 if (delegate) | 753 if (delegate) |
752 delegate->PostSpawnTarget(target.process_handle()); | 754 delegate->PostSpawnTarget(target.process_handle()); |
753 | 755 |
754 CHECK(ResumeThread(target.thread_handle()) != -1); | 756 CHECK(ResumeThread(target.thread_handle()) != -1); |
755 TRACE_EVENT_END_ETW("StartProcessWithAccess", 0, type_str); | 757 TRACE_EVENT_END_ETW("StartProcessWithAccess", 0, type_str); |
756 return base::Process(target.TakeProcessHandle()); | 758 return base::Process(target.TakeProcessHandle()); |
757 } | 759 } |
(...skipping 30 matching lines...) Expand all Loading... |
788 } | 790 } |
789 | 791 |
790 return false; | 792 return false; |
791 } | 793 } |
792 | 794 |
793 bool BrokerAddTargetPeer(HANDLE peer_process) { | 795 bool BrokerAddTargetPeer(HANDLE peer_process) { |
794 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 796 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
795 } | 797 } |
796 | 798 |
797 } // namespace content | 799 } // namespace content |
OLD | NEW |