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

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

Issue 1460903002: Unify PolicyBase into TargetPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy_dispatcher
Patch Set: Rebase. Created 5 years 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 | « no previous file | sandbox/win/BUILD.gn » ('j') | sandbox/win/src/sandbox_policy.h » ('J')
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"
(...skipping 17 matching lines...) Expand all
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #include "content/common/content_switches_internal.h" 29 #include "content/common/content_switches_internal.h"
30 #include "content/public/common/content_client.h" 30 #include "content/public/common/content_client.h"
31 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/dwrite_font_platform_win.h" 32 #include "content/public/common/dwrite_font_platform_win.h"
33 #include "content/public/common/sandbox_init.h" 33 #include "content/public/common/sandbox_init.h"
34 #include "content/public/common/sandboxed_process_launcher_delegate.h" 34 #include "content/public/common/sandboxed_process_launcher_delegate.h"
35 #include "sandbox/win/src/process_mitigations.h" 35 #include "sandbox/win/src/process_mitigations.h"
36 #include "sandbox/win/src/sandbox.h" 36 #include "sandbox/win/src/sandbox.h"
37 #include "sandbox/win/src/sandbox_nt_util.h" 37 #include "sandbox/win/src/sandbox_nt_util.h"
38 #include "sandbox/win/src/sandbox_policy_base.h" 38 #include "sandbox/win/src/sandbox_policy.h"
39 #include "sandbox/win/src/win_utils.h" 39 #include "sandbox/win/src/win_utils.h"
40 #include "ui/gfx/win/direct_write.h" 40 #include "ui/gfx/win/direct_write.h"
41 41
42 static sandbox::BrokerServices* g_broker_services = NULL; 42 static sandbox::BrokerServices* g_broker_services = NULL;
43 static sandbox::TargetServices* g_target_services = NULL; 43 static sandbox::TargetServices* g_target_services = NULL;
44 44
45 namespace content { 45 namespace content {
46 namespace { 46 namespace {
47 47
48 // The DLLs listed here are known (or under strong suspicion) of causing crashes 48 // The DLLs listed here are known (or under strong suspicion) of causing crashes
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 base::win::ScopedProcessInformation target(temp_process_info); 795 base::win::ScopedProcessInformation target(temp_process_info);
796 796
797 TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); 797 TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS");
798 798
799 if (sandbox::SBOX_ALL_OK != result) { 799 if (sandbox::SBOX_ALL_OK != result) {
800 if (result == sandbox::SBOX_ERROR_GENERIC) 800 if (result == sandbox::SBOX_ERROR_GENERIC)
801 DPLOG(ERROR) << "Failed to launch process"; 801 DPLOG(ERROR) << "Failed to launch process";
802 else if (result == sandbox::SBOX_ERROR_CREATE_PROCESS) { 802 else if (result == sandbox::SBOX_ERROR_CREATE_PROCESS) {
803 // TODO(shrikant): Remove this special case handling after determining 803 // TODO(shrikant): Remove this special case handling after determining
804 // cause for lowbox/createprocess errors. 804 // cause for lowbox/createprocess errors.
805 sandbox::PolicyBase* policy_base = 805 UMA_HISTOGRAM_SPARSE_SLOWLY(policy->GetLowBoxSid()
806 static_cast<sandbox::PolicyBase*>(policy); 806 ? "Process.Sandbox.Lowbox.Launch.Error"
cpu_(ooo_6.6-7.5) 2016/01/06 18:09:40 can you please remove the UMA_HISTO call? I don't
807 UMA_HISTOGRAM_SPARSE_SLOWLY(policy_base->GetLowBoxSid() ? 807 : "Process.Sandbox.Launch.Error",
808 "Process.Sandbox.Lowbox.Launch.Error" :
809 "Process.Sandbox.Launch.Error",
810 last_error); 808 last_error);
811 } else 809 } else
812 DLOG(ERROR) << "Failed to launch process. Error: " << result; 810 DLOG(ERROR) << "Failed to launch process. Error: " << result;
813 811
814 return base::Process(); 812 return base::Process();
815 } 813 }
816 814
817 delegate->PostSpawnTarget(target.process_handle()); 815 delegate->PostSpawnTarget(target.process_handle());
818 816
819 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); 817 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 } 849 }
852 850
853 return false; 851 return false;
854 } 852 }
855 853
856 bool BrokerAddTargetPeer(HANDLE peer_process) { 854 bool BrokerAddTargetPeer(HANDLE peer_process) {
857 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 855 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
858 } 856 }
859 857
860 } // namespace content 858 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | sandbox/win/BUILD.gn » ('j') | sandbox/win/src/sandbox_policy.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698