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

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

Issue 1185333003: Implement GetSandboxType() on all platforms and implement for all process types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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 10 matching lines...) Expand all
21 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
22 #include "base/win/iat_patch_function.h" 22 #include "base/win/iat_patch_function.h"
23 #include "base/win/scoped_handle.h" 23 #include "base/win/scoped_handle.h"
24 #include "base/win/scoped_process_information.h" 24 #include "base/win/scoped_process_information.h"
25 #include "base/win/windows_version.h" 25 #include "base/win/windows_version.h"
26 #include "content/common/content_switches_internal.h" 26 #include "content/common/content_switches_internal.h"
27 #include "content/public/common/content_client.h" 27 #include "content/public/common/content_client.h"
28 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
29 #include "content/public/common/dwrite_font_platform_win.h" 29 #include "content/public/common/dwrite_font_platform_win.h"
30 #include "content/public/common/sandbox_init.h" 30 #include "content/public/common/sandbox_init.h"
31 #include "content/public/common/sandbox_type.h"
31 #include "content/public/common/sandboxed_process_launcher_delegate.h" 32 #include "content/public/common/sandboxed_process_launcher_delegate.h"
32 #include "sandbox/win/src/process_mitigations.h" 33 #include "sandbox/win/src/process_mitigations.h"
33 #include "sandbox/win/src/sandbox.h" 34 #include "sandbox/win/src/sandbox.h"
34 #include "sandbox/win/src/sandbox_nt_util.h" 35 #include "sandbox/win/src/sandbox_nt_util.h"
35 #include "sandbox/win/src/sandbox_policy_base.h" 36 #include "sandbox/win/src/sandbox_policy_base.h"
36 #include "sandbox/win/src/win_utils.h" 37 #include "sandbox/win/src/win_utils.h"
37 #include "ui/gfx/win/direct_write.h" 38 #include "ui/gfx/win/direct_write.h"
38 39
39 static sandbox::BrokerServices* g_broker_services = NULL; 40 static sandbox::BrokerServices* g_broker_services = NULL;
40 static sandbox::TargetServices* g_target_services = NULL; 41 static sandbox::TargetServices* g_target_services = NULL;
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 569
569 // TODO(jschuh): Need get these restrictions applied to NaCl and Pepper. 570 // TODO(jschuh): Need get these restrictions applied to NaCl and Pepper.
570 // Just have to figure out what needs to be warmed up first. 571 // Just have to figure out what needs to be warmed up first.
571 void AddBaseHandleClosePolicy(sandbox::TargetPolicy* policy) { 572 void AddBaseHandleClosePolicy(sandbox::TargetPolicy* policy) {
572 // TODO(cpu): Add back the BaseNamedObjects policy. 573 // TODO(cpu): Add back the BaseNamedObjects policy.
573 base::string16 object_path = PrependWindowsSessionPath( 574 base::string16 object_path = PrependWindowsSessionPath(
574 L"\\BaseNamedObjects\\windows_shell_global_counters"); 575 L"\\BaseNamedObjects\\windows_shell_global_counters");
575 policy->AddKernelObjectToClose(L"Section", object_path.data()); 576 policy->AddKernelObjectToClose(L"Section", object_path.data());
576 } 577 }
577 578
579 void MaybeAddAppContainerPolicy(sandbox::TargetPolicy* policy,
nasko 2015/06/19 12:18:19 nit: I'm not a fan of the "Maybe" prefix. While it
jschuh 2015/06/19 14:05:08 Agreed on the "maybe" and I had typed a comment to
Will Harris 2015/06/24 11:37:09 Done.
Will Harris 2015/06/24 11:37:09 Done.
580 const wchar_t* sid) {
581 if (base::win::GetVersion() == base::win::VERSION_WIN8 ||
582 base::win::GetVersion() == base::win::VERSION_WIN8_1) {
583 const base::CommandLine& command_line =
584 *base::CommandLine::ForCurrentProcess();
585 if (!command_line.HasSwitch(switches::kDisableAppContainer)) {
586 policy->SetLowBox(sid);
587 }
588 }
589 }
590
578 bool InitBrokerServices(sandbox::BrokerServices* broker_services) { 591 bool InitBrokerServices(sandbox::BrokerServices* broker_services) {
579 // TODO(abarth): DCHECK(CalledOnValidThread()); 592 // TODO(abarth): DCHECK(CalledOnValidThread());
580 // See <http://b/1287166>. 593 // See <http://b/1287166>.
581 DCHECK(broker_services); 594 DCHECK(broker_services);
582 DCHECK(!g_broker_services); 595 DCHECK(!g_broker_services);
583 sandbox::ResultCode result = broker_services->Init(); 596 sandbox::ResultCode result = broker_services->Init();
584 g_broker_services = broker_services; 597 g_broker_services = broker_services;
585 598
586 // In non-official builds warn about dangerous uses of DuplicateHandle. 599 // In non-official builds warn about dangerous uses of DuplicateHandle.
587 #ifndef OFFICIAL_BUILD 600 #ifndef OFFICIAL_BUILD
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 846 }
834 847
835 return false; 848 return false;
836 } 849 }
837 850
838 bool BrokerAddTargetPeer(HANDLE peer_process) { 851 bool BrokerAddTargetPeer(HANDLE peer_process) {
839 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 852 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
840 } 853 }
841 854
842 } // namespace content 855 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698