Chromium Code Reviews| 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" |
| 11 #include "base/debug/profiler.h" | 11 #include "base/debug/profiler.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/hash.h" | 13 #include "base/hash.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 16 #include "base/metrics/field_trial.h" | |
| 16 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 18 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
| 19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 21 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 22 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 23 #include "base/win/iat_patch_function.h" | 24 #include "base/win/iat_patch_function.h" |
| 24 #include "base/win/scoped_handle.h" | 25 #include "base/win/scoped_handle.h" |
| 25 #include "base/win/scoped_process_information.h" | 26 #include "base/win/scoped_process_information.h" |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 562 // TODO(cpu): Add back the BaseNamedObjects policy. | 563 // TODO(cpu): Add back the BaseNamedObjects policy. |
| 563 base::string16 object_path = PrependWindowsSessionPath( | 564 base::string16 object_path = PrependWindowsSessionPath( |
| 564 L"\\BaseNamedObjects\\windows_shell_global_counters"); | 565 L"\\BaseNamedObjects\\windows_shell_global_counters"); |
| 565 policy->AddKernelObjectToClose(L"Section", object_path.data()); | 566 policy->AddKernelObjectToClose(L"Section", object_path.data()); |
| 566 } | 567 } |
| 567 | 568 |
| 568 void AddAppContainerPolicy(sandbox::TargetPolicy* policy, const wchar_t* sid) { | 569 void AddAppContainerPolicy(sandbox::TargetPolicy* policy, const wchar_t* sid) { |
| 569 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 570 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 570 const base::CommandLine& command_line = | 571 const base::CommandLine& command_line = |
| 571 *base::CommandLine::ForCurrentProcess(); | 572 *base::CommandLine::ForCurrentProcess(); |
| 572 if (command_line.HasSwitch(switches::kEnableAppContainer)) { | 573 std::string appcontainer_trial_name = |
| 574 base::FieldTrialList::FindFullName("EnableAppContainer"); | |
| 575 if (command_line.HasSwitch(switches::kEnableAppContainer) || | |
| 576 appcontainer_trial_name == "Enabled") { | |
|
Alexei Svitkine (slow)
2015/11/02 17:27:52
Does this code run in the child process, browser p
| |
| 573 policy->SetLowBox(sid); | 577 policy->SetLowBox(sid); |
| 574 } | 578 } |
| 575 } | 579 } |
| 576 } | 580 } |
| 577 | 581 |
| 578 bool AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy) { | 582 bool AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy) { |
| 579 #if !defined(NACL_WIN64) | 583 #if !defined(NACL_WIN64) |
| 580 if (!IsWin32kRendererLockdownEnabled()) | 584 if (!IsWin32kRendererLockdownEnabled()) |
| 581 return true; | 585 return true; |
| 582 | 586 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 } | 870 } |
| 867 | 871 |
| 868 return false; | 872 return false; |
| 869 } | 873 } |
| 870 | 874 |
| 871 bool BrokerAddTargetPeer(HANDLE peer_process) { | 875 bool BrokerAddTargetPeer(HANDLE peer_process) { |
| 872 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 876 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
| 873 } | 877 } |
| 874 | 878 |
| 875 } // namespace content | 879 } // namespace content |
| OLD | NEW |