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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 | 253 |
254 bool SandboxSeccompBPF::SupportsSandbox() { | 254 bool SandboxSeccompBPF::SupportsSandbox() { |
255 #if defined(USE_SECCOMP_BPF) | 255 #if defined(USE_SECCOMP_BPF) |
256 return SandboxBPF::SupportsSeccompSandbox( | 256 return SandboxBPF::SupportsSeccompSandbox( |
257 SandboxBPF::SeccompLevel::SINGLE_THREADED); | 257 SandboxBPF::SeccompLevel::SINGLE_THREADED); |
258 #endif | 258 #endif |
259 return false; | 259 return false; |
260 } | 260 } |
261 | 261 |
| 262 bool SandboxSeccompBPF::SupportsSandboxWithTsync() { |
| 263 #if defined(USE_SECCOMP_BPF) |
| 264 return SandboxBPF::SupportsSeccompSandbox( |
| 265 SandboxBPF::SeccompLevel::MULTI_THREADED); |
| 266 #endif |
| 267 return false; |
| 268 } |
| 269 |
262 bool SandboxSeccompBPF::StartSandbox(const std::string& process_type, | 270 bool SandboxSeccompBPF::StartSandbox(const std::string& process_type, |
263 base::ScopedFD proc_task_fd) { | 271 base::ScopedFD proc_task_fd) { |
264 #if defined(USE_SECCOMP_BPF) | 272 #if defined(USE_SECCOMP_BPF) |
265 const base::CommandLine& command_line = | 273 const base::CommandLine& command_line = |
266 *base::CommandLine::ForCurrentProcess(); | 274 *base::CommandLine::ForCurrentProcess(); |
267 | 275 |
268 if (IsSeccompBPFDesired() && // Global switches policy. | 276 if (IsSeccompBPFDesired() && // Global switches policy. |
269 ShouldEnableSeccompBPF(process_type) && // Process-specific policy. | 277 ShouldEnableSeccompBPF(process_type) && // Process-specific policy. |
270 SupportsSandbox()) { | 278 SupportsSandbox()) { |
271 // If the kernel supports the sandbox, and if the command line says we | 279 // If the kernel supports the sandbox, and if the command line says we |
(...skipping 22 matching lines...) Expand all Loading... |
294 | 302 |
295 scoped_ptr<sandbox::bpf_dsl::Policy> SandboxSeccompBPF::GetBaselinePolicy() { | 303 scoped_ptr<sandbox::bpf_dsl::Policy> SandboxSeccompBPF::GetBaselinePolicy() { |
296 #if defined(USE_SECCOMP_BPF) | 304 #if defined(USE_SECCOMP_BPF) |
297 return scoped_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy); | 305 return scoped_ptr<sandbox::bpf_dsl::Policy>(new BaselinePolicy); |
298 #else | 306 #else |
299 return scoped_ptr<sandbox::bpf_dsl::Policy>(); | 307 return scoped_ptr<sandbox::bpf_dsl::Policy>(); |
300 #endif // defined(USE_SECCOMP_BPF) | 308 #endif // defined(USE_SECCOMP_BPF) |
301 } | 309 } |
302 | 310 |
303 } // namespace content | 311 } // namespace content |
OLD | NEW |