| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/nonsfi/nonsfi_sandbox.h" | 5 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <linux/futex.h> | 9 #include <linux/futex.h> |
| 10 #include <linux/net.h> | 10 #include <linux/net.h> |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 if (IsGracefullyDenied(sysno)) | 293 if (IsGracefullyDenied(sysno)) |
| 294 return Error(EPERM); | 294 return Error(EPERM); |
| 295 return CrashSIGSYS(); | 295 return CrashSIGSYS(); |
| 296 } | 296 } |
| 297 } | 297 } |
| 298 | 298 |
| 299 ResultExpr NaClNonSfiBPFSandboxPolicy::InvalidSyscall() const { | 299 ResultExpr NaClNonSfiBPFSandboxPolicy::InvalidSyscall() const { |
| 300 return CrashSIGSYS(); | 300 return CrashSIGSYS(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 bool InitializeBPFSandbox() { | 303 bool InitializeBPFSandbox(base::ScopedFD proc_task_fd) { |
| 304 bool sandbox_is_initialized = | 304 bool sandbox_is_initialized = content::InitializeSandbox( |
| 305 content::InitializeSandbox(scoped_ptr<sandbox::bpf_dsl::Policy>( | 305 scoped_ptr<sandbox::bpf_dsl::Policy>( |
| 306 new nacl::nonsfi::NaClNonSfiBPFSandboxPolicy())); | 306 new nacl::nonsfi::NaClNonSfiBPFSandboxPolicy()), |
| 307 proc_task_fd.Pass()); |
| 307 if (!sandbox_is_initialized) | 308 if (!sandbox_is_initialized) |
| 308 return false; | 309 return false; |
| 309 RunSandboxSanityChecks(); | 310 RunSandboxSanityChecks(); |
| 310 return true; | 311 return true; |
| 311 } | 312 } |
| 312 | 313 |
| 313 } // namespace nonsfi | 314 } // namespace nonsfi |
| 314 } // namespace nacl | 315 } // namespace nacl |
| OLD | NEW |