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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(USE_SECCOMP_BPF) | 9 #if defined(USE_SECCOMP_BPF) |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
158 | 158 |
159 #else | 159 #else |
160 | 160 |
161 #error "Seccomp-bpf disabled on supported architecture!" | 161 #error "Seccomp-bpf disabled on supported architecture!" |
162 | 162 |
163 #endif // defined(USE_SECCOMP_BPF) | 163 #endif // defined(USE_SECCOMP_BPF) |
164 | 164 |
165 bool InitializeBPFSandbox(base::ScopedFD proc_task_fd) { | 165 bool InitializeBPFSandbox(base::ScopedFD proc_fd) { |
166 #if defined(USE_SECCOMP_BPF) | 166 #if defined(USE_SECCOMP_BPF) |
167 bool sandbox_is_initialized = content::InitializeSandbox( | 167 bool sandbox_is_initialized = content::InitializeSandbox( |
168 scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy), | 168 scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy), |
169 proc_task_fd.Pass()); | 169 proc_fd.Pass()); |
170 if (sandbox_is_initialized) { | 170 if (sandbox_is_initialized) { |
171 RunSandboxSanityChecks(); | 171 RunSandboxSanityChecks(); |
172 return true; | 172 return true; |
173 } | 173 } |
174 #endif // defined(USE_SECCOMP_BPF) | 174 #endif // defined(USE_SECCOMP_BPF) |
175 return false; | 175 return false; |
176 } | 176 } |
177 | 177 |
178 } // namespace nacl | 178 } // namespace nacl |
OLD | NEW |