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/nacl_sandbox_linux.h" | 5 #include "components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <sys/ptrace.h> | 9 #include <sys/ptrace.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 | 16 |
17 #if defined(USE_SECCOMP_BPF) | 17 #if defined(USE_SECCOMP_BPF) |
18 #include "content/public/common/sandbox_init.h" | 18 #include "content/public/common/sandbox_init.h" |
19 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 19 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
20 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" | 20 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" |
21 #include "sandbox/linux/services/linux_syscalls.h" | 21 #include "sandbox/linux/services/linux_syscalls.h" |
22 | 22 |
23 using sandbox::ErrorCode; | 23 using sandbox::ErrorCode; |
24 using sandbox::SandboxBPF; | 24 using sandbox::SandboxBPF; |
25 using sandbox::SandboxBPFPolicy; | 25 using sandbox::SandboxBPFPolicy; |
26 | 26 |
| 27 namespace nacl { |
| 28 |
27 namespace { | 29 namespace { |
28 | 30 |
29 // On ARM and x86_64, System V shared memory calls have each their own system | 31 // On ARM and x86_64, System V shared memory calls have each their own system |
30 // call, while on i386 they are multiplexed. | 32 // call, while on i386 they are multiplexed. |
31 #if defined(__x86_64__) || defined(__arm__) | 33 #if defined(__x86_64__) || defined(__arm__) |
32 bool IsSystemVSharedMemory(int sysno) { | 34 bool IsSystemVSharedMemory(int sysno) { |
33 switch (sysno) { | 35 switch (sysno) { |
34 case __NR_shmat: | 36 case __NR_shmat: |
35 case __NR_shmctl: | 37 case __NR_shmctl: |
36 case __NR_shmdt: | 38 case __NR_shmdt: |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 #if defined(USE_SECCOMP_BPF) | 167 #if defined(USE_SECCOMP_BPF) |
166 bool sandbox_is_initialized = content::InitializeSandbox( | 168 bool sandbox_is_initialized = content::InitializeSandbox( |
167 scoped_ptr<SandboxBPFPolicy>(new NaClBPFSandboxPolicy())); | 169 scoped_ptr<SandboxBPFPolicy>(new NaClBPFSandboxPolicy())); |
168 if (sandbox_is_initialized) { | 170 if (sandbox_is_initialized) { |
169 RunSandboxSanityChecks(); | 171 RunSandboxSanityChecks(); |
170 return true; | 172 return true; |
171 } | 173 } |
172 #endif // defined(USE_SECCOMP_BPF) | 174 #endif // defined(USE_SECCOMP_BPF) |
173 return false; | 175 return false; |
174 } | 176 } |
| 177 |
| 178 } // namespace nacl |
OLD | NEW |