| 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_linux/sandbox_seccomp_bpf_linux.h" | 5 #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 const base::CommandLine& command_line = | 165 const base::CommandLine& command_line = |
| 166 *base::CommandLine::ForCurrentProcess(); | 166 *base::CommandLine::ForCurrentProcess(); |
| 167 if (IsChromeOS() && IsArchitectureArm()) { | 167 if (IsChromeOS() && IsArchitectureArm()) { |
| 168 bool allow_sysv_shm = | 168 bool allow_sysv_shm = |
| 169 command_line.HasSwitch(switches::kGpuSandboxAllowSysVShm); | 169 command_line.HasSwitch(switches::kGpuSandboxAllowSysVShm); |
| 170 return std::unique_ptr<SandboxBPFBasePolicy>( | 170 return std::unique_ptr<SandboxBPFBasePolicy>( |
| 171 new CrosArmGpuProcessPolicy(allow_sysv_shm)); | 171 new CrosArmGpuProcessPolicy(allow_sysv_shm)); |
| 172 } else { | 172 } else { |
| 173 bool allow_mincore = command_line.HasSwitch(switches::kUseGL) && | 173 bool allow_mincore = command_line.HasSwitch(switches::kUseGL) && |
| 174 command_line.GetSwitchValueASCII(switches::kUseGL) == | 174 command_line.GetSwitchValueASCII(switches::kUseGL) == |
| 175 gfx::kGLImplementationEGLName; | 175 gl::kGLImplementationEGLName; |
| 176 return std::unique_ptr<SandboxBPFBasePolicy>( | 176 return std::unique_ptr<SandboxBPFBasePolicy>( |
| 177 new GpuProcessPolicy(allow_mincore)); | 177 new GpuProcessPolicy(allow_mincore)); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Initialize the seccomp-bpf sandbox. | 181 // Initialize the seccomp-bpf sandbox. |
| 182 bool StartBPFSandbox(const base::CommandLine& command_line, | 182 bool StartBPFSandbox(const base::CommandLine& command_line, |
| 183 const std::string& process_type, | 183 const std::string& process_type, |
| 184 base::ScopedFD proc_fd) { | 184 base::ScopedFD proc_fd) { |
| 185 std::unique_ptr<SandboxBPFBasePolicy> policy; | 185 std::unique_ptr<SandboxBPFBasePolicy> policy; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 SandboxSeccompBPF::GetBaselinePolicy() { | 299 SandboxSeccompBPF::GetBaselinePolicy() { |
| 300 #if defined(USE_SECCOMP_BPF) | 300 #if defined(USE_SECCOMP_BPF) |
| 301 return std::unique_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy); | 301 return std::unique_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy); |
| 302 #else | 302 #else |
| 303 return std::unique_ptr<sandbox::bpf_dsl::Policy>(); | 303 return std::unique_ptr<sandbox::bpf_dsl::Policy>(); |
| 304 #endif // defined(USE_SECCOMP_BPF) | 304 #endif // defined(USE_SECCOMP_BPF) |
| 305 } | 305 } |
| 306 #endif // !defined(OS_NACL_NONSFI) | 306 #endif // !defined(OS_NACL_NONSFI) |
| 307 | 307 |
| 308 } // namespace content | 308 } // namespace content |
| OLD | NEW |