| 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> |
| 11 #include <sys/stat.h> | |
| 12 #include <sys/types.h> | |
| 13 #include <sys/types.h> | 11 #include <sys/types.h> |
| 14 | 12 |
| 15 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 16 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 17 #include "base/logging.h" | 15 #include "base/logging.h" |
| 18 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 19 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 20 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" | 18 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 21 | 19 |
| 22 #if defined(USE_SECCOMP_BPF) | 20 #if defined(USE_SECCOMP_BPF) |
| 23 | 21 |
| 24 #include "base/posix/eintr_wrapper.h" | 22 #include "base/posix/eintr_wrapper.h" |
| 25 #include "content/common/sandbox_linux/bpf_cros_arm_gpu_policy_linux.h" | 23 #include "content/common/sandbox_linux/bpf_cros_arm_gpu_policy_linux.h" |
| 26 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h" | 24 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h" |
| 27 #include "content/common/sandbox_linux/bpf_ppapi_policy_linux.h" | 25 #include "content/common/sandbox_linux/bpf_ppapi_policy_linux.h" |
| 28 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h" | 26 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h" |
| 29 #include "content/common/sandbox_linux/bpf_utility_policy_linux.h" | 27 #include "content/common/sandbox_linux/bpf_utility_policy_linux.h" |
| 30 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" | 28 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // should enable it, enable it or die. | 265 // should enable it, enable it or die. |
| 268 bool started_sandbox = StartBPFSandbox(command_line, process_type); | 266 bool started_sandbox = StartBPFSandbox(command_line, process_type); |
| 269 CHECK(started_sandbox); | 267 CHECK(started_sandbox); |
| 270 return true; | 268 return true; |
| 271 } | 269 } |
| 272 #endif | 270 #endif |
| 273 return false; | 271 return false; |
| 274 } | 272 } |
| 275 | 273 |
| 276 bool SandboxSeccompBPF::StartSandboxWithExternalPolicy( | 274 bool SandboxSeccompBPF::StartSandboxWithExternalPolicy( |
| 277 scoped_ptr<sandbox::SandboxBPFPolicy> policy) { | 275 scoped_ptr<sandbox::bpf_dsl::SandboxBPFDSLPolicy> policy) { |
| 278 #if defined(USE_SECCOMP_BPF) | 276 #if defined(USE_SECCOMP_BPF) |
| 279 if (IsSeccompBPFDesired() && SupportsSandbox()) { | 277 if (IsSeccompBPFDesired() && SupportsSandbox()) { |
| 280 CHECK(policy); | 278 CHECK(policy); |
| 281 StartSandboxWithPolicy(policy.release()); | 279 StartSandboxWithPolicy(policy.release()); |
| 282 return true; | 280 return true; |
| 283 } | 281 } |
| 284 #endif // defined(USE_SECCOMP_BPF) | 282 #endif // defined(USE_SECCOMP_BPF) |
| 285 return false; | 283 return false; |
| 286 } | 284 } |
| 287 | 285 |
| 288 scoped_ptr<sandbox::SandboxBPFPolicy> | 286 scoped_ptr<sandbox::bpf_dsl::SandboxBPFDSLPolicy> |
| 289 SandboxSeccompBPF::GetBaselinePolicy() { | 287 SandboxSeccompBPF::GetBaselinePolicy() { |
| 290 #if defined(USE_SECCOMP_BPF) | 288 #if defined(USE_SECCOMP_BPF) |
| 291 return scoped_ptr<sandbox::SandboxBPFPolicy>(new BaselinePolicy); | 289 return scoped_ptr<sandbox::bpf_dsl::SandboxBPFDSLPolicy>(new BaselinePolicy); |
| 292 #else | 290 #else |
| 293 return scoped_ptr<sandbox::SandboxBPFPolicy>(); | 291 return scoped_ptr<sandbox::bpf_dsl::SandboxBPFDSLPolicy>(); |
| 294 #endif // defined(USE_SECCOMP_BPF) | 292 #endif // defined(USE_SECCOMP_BPF) |
| 295 } | 293 } |
| 296 | 294 |
| 297 } // namespace content | 295 } // namespace content |
| OLD | NEW |