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_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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 syscall_ret = socket(AF_NETLINK, SOCK_DGRAM, 0); | 157 syscall_ret = socket(AF_NETLINK, SOCK_DGRAM, 0); |
| 158 CHECK_EQ(-1, syscall_ret); | 158 CHECK_EQ(-1, syscall_ret); |
| 159 CHECK_EQ(EPERM, errno); | 159 CHECK_EQ(EPERM, errno); |
| 160 #endif // !defined(NDEBUG) | 160 #endif // !defined(NDEBUG) |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 std::unique_ptr<SandboxBPFBasePolicy> GetGpuProcessSandbox() { | 164 std::unique_ptr<SandboxBPFBasePolicy> GetGpuProcessSandbox() { |
| 165 const base::CommandLine& command_line = | 165 const base::CommandLine& command_line = |
| 166 *base::CommandLine::ForCurrentProcess(); | 166 *base::CommandLine::ForCurrentProcess(); |
| 167 bool allow_sysv_shm = false; | |
| 168 if (command_line.HasSwitch(switches::kGpuSandboxAllowSysVShm)) { | |
| 169 DCHECK(IsArchitectureArm()); | |
|
Peter Kasting
2016/05/19 05:32:37
Technically this DCHECK is incorrect; it's perfect
| |
| 170 allow_sysv_shm = true; | |
| 171 } | |
| 172 | |
| 173 if (IsChromeOS() && IsArchitectureArm()) { | 167 if (IsChromeOS() && IsArchitectureArm()) { |
| 168 bool allow_sysv_shm = | |
| 169 command_line.HasSwitch(switches::kGpuSandboxAllowSysVShm); | |
| 174 return std::unique_ptr<SandboxBPFBasePolicy>( | 170 return std::unique_ptr<SandboxBPFBasePolicy>( |
| 175 new CrosArmGpuProcessPolicy(allow_sysv_shm)); | 171 new CrosArmGpuProcessPolicy(allow_sysv_shm)); |
| 176 } else { | 172 } else { |
| 177 bool allow_mincore = command_line.HasSwitch(switches::kUseGL) && | 173 bool allow_mincore = command_line.HasSwitch(switches::kUseGL) && |
| 178 command_line.GetSwitchValueASCII(switches::kUseGL) == | 174 command_line.GetSwitchValueASCII(switches::kUseGL) == |
| 179 gfx::kGLImplementationEGLName; | 175 gfx::kGLImplementationEGLName; |
| 180 return std::unique_ptr<SandboxBPFBasePolicy>( | 176 return std::unique_ptr<SandboxBPFBasePolicy>( |
| 181 new GpuProcessPolicy(allow_mincore)); | 177 new GpuProcessPolicy(allow_mincore)); |
| 182 } | 178 } |
| 183 } | 179 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 SandboxSeccompBPF::GetBaselinePolicy() { | 299 SandboxSeccompBPF::GetBaselinePolicy() { |
| 304 #if defined(USE_SECCOMP_BPF) | 300 #if defined(USE_SECCOMP_BPF) |
| 305 return std::unique_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy); | 301 return std::unique_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy); |
| 306 #else | 302 #else |
| 307 return std::unique_ptr<sandbox::bpf_dsl::Policy>(); | 303 return std::unique_ptr<sandbox::bpf_dsl::Policy>(); |
| 308 #endif // defined(USE_SECCOMP_BPF) | 304 #endif // defined(USE_SECCOMP_BPF) |
| 309 } | 305 } |
| 310 #endif // !defined(OS_NACL_NONSFI) | 306 #endif // !defined(OS_NACL_NONSFI) |
| 311 | 307 |
| 312 } // namespace content | 308 } // namespace content |
| OLD | NEW |