| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.h" | 5 #include "components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/macros.h" | 9 #include "base/macros.h" |
| 8 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 9 | 11 |
| 10 #if defined(USE_SECCOMP_BPF) | 12 #if defined(USE_SECCOMP_BPF) |
| 11 | 13 |
| 12 #include <errno.h> | 14 #include <errno.h> |
| 13 #include <signal.h> | 15 #include <signal.h> |
| 14 #include <sys/ptrace.h> | 16 #include <sys/ptrace.h> |
| 15 #include <sys/types.h> | 17 #include <sys/types.h> |
| 16 #include <unistd.h> | 18 #include <unistd.h> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 #else | 161 #else |
| 160 | 162 |
| 161 #error "Seccomp-bpf disabled on supported architecture!" | 163 #error "Seccomp-bpf disabled on supported architecture!" |
| 162 | 164 |
| 163 #endif // defined(USE_SECCOMP_BPF) | 165 #endif // defined(USE_SECCOMP_BPF) |
| 164 | 166 |
| 165 bool InitializeBPFSandbox(base::ScopedFD proc_fd) { | 167 bool InitializeBPFSandbox(base::ScopedFD proc_fd) { |
| 166 #if defined(USE_SECCOMP_BPF) | 168 #if defined(USE_SECCOMP_BPF) |
| 167 bool sandbox_is_initialized = content::InitializeSandbox( | 169 bool sandbox_is_initialized = content::InitializeSandbox( |
| 168 scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy), | 170 scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy), |
| 169 proc_fd.Pass()); | 171 std::move(proc_fd)); |
| 170 if (sandbox_is_initialized) { | 172 if (sandbox_is_initialized) { |
| 171 RunSandboxSanityChecks(); | 173 RunSandboxSanityChecks(); |
| 172 return true; | 174 return true; |
| 173 } | 175 } |
| 174 #endif // defined(USE_SECCOMP_BPF) | 176 #endif // defined(USE_SECCOMP_BPF) |
| 175 return false; | 177 return false; |
| 176 } | 178 } |
| 177 | 179 |
| 178 } // namespace nacl | 180 } // namespace nacl |
| OLD | NEW |