OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/shell/runner/host/child_process_base.h" | 5 #include "services/shell/runner/host/child_process_base.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 namespace shell { | 31 namespace shell { |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 35 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
36 std::unique_ptr<LinuxSandbox> InitializeSandbox() { | 36 std::unique_ptr<LinuxSandbox> InitializeSandbox() { |
37 using sandbox::syscall_broker::BrokerFilePermission; | 37 using sandbox::syscall_broker::BrokerFilePermission; |
38 // Warm parts of base in the copy of base in the mojo runner. | 38 // Warm parts of base in the copy of base in the mojo runner. |
39 base::RandUint64(); | 39 base::RandUint64(); |
40 base::SysInfo::AmountOfPhysicalMemory(); | 40 base::SysInfo::AmountOfPhysicalMemory(); |
41 base::SysInfo::MaxSharedMemorySize(); | |
42 base::SysInfo::NumberOfProcessors(); | 41 base::SysInfo::NumberOfProcessors(); |
43 | 42 |
44 // TODO(erg,jln): Allowing access to all of /dev/shm/ makes it easy to | 43 // TODO(erg,jln): Allowing access to all of /dev/shm/ makes it easy to |
45 // spy on other shared memory using processes. This is a temporary hack | 44 // spy on other shared memory using processes. This is a temporary hack |
46 // so that we have some sandbox until we have proper shared memory | 45 // so that we have some sandbox until we have proper shared memory |
47 // support integrated into mojo. | 46 // support integrated into mojo. |
48 std::vector<BrokerFilePermission> permissions; | 47 std::vector<BrokerFilePermission> permissions; |
49 permissions.push_back( | 48 permissions.push_back( |
50 BrokerFilePermission::ReadWriteCreateUnlinkRecursive("/dev/shm/")); | 49 BrokerFilePermission::ReadWriteCreateUnlinkRecursive("/dev/shm/")); |
51 std::unique_ptr<LinuxSandbox> sandbox(new LinuxSandbox(permissions)); | 50 std::unique_ptr<LinuxSandbox> sandbox(new LinuxSandbox(permissions)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 *base::CommandLine::ForCurrentProcess(); | 119 *base::CommandLine::ForCurrentProcess(); |
121 if (command_line.HasSwitch(switches::kEnableSandbox)) | 120 if (command_line.HasSwitch(switches::kEnableSandbox)) |
122 sandbox = InitializeSandbox(); | 121 sandbox = InitializeSandbox(); |
123 #endif | 122 #endif |
124 | 123 |
125 ScopedAppContext app_context; | 124 ScopedAppContext app_context; |
126 callback.Run(GetShellClientRequestFromCommandLine()); | 125 callback.Run(GetShellClientRequestFromCommandLine()); |
127 } | 126 } |
128 | 127 |
129 } // namespace shell | 128 } // namespace shell |
OLD | NEW |