| 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 "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 5 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 6 | 6 |
| 7 // Some headers on Android are missing cdefs: crbug.com/172337. | 7 // Some headers on Android are missing cdefs: crbug.com/172337. |
| 8 // (We can't use OS_ANDROID here since build_config.h is not included). | 8 // (We can't use OS_ANDROID here since build_config.h is not included). |
| 9 #if defined(ANDROID) | 9 #if defined(ANDROID) |
| 10 #include <sys/cdefs.h> | 10 #include <sys/cdefs.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <errno.h> | 13 #include <errno.h> |
| 14 #include <linux/filter.h> | |
| 15 #include <sys/prctl.h> | 14 #include <sys/prctl.h> |
| 16 #include <sys/types.h> | 15 #include <sys/types.h> |
| 17 #include <unistd.h> | 16 #include <unistd.h> |
| 18 | 17 |
| 19 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 20 #include "base/files/scoped_file.h" | 19 #include "base/files/scoped_file.h" |
| 21 #include "base/logging.h" | 20 #include "base/logging.h" |
| 22 #include "base/macros.h" | 21 #include "base/macros.h" |
| 23 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
| 24 #include "base/posix/eintr_wrapper.h" | 23 #include "base/posix/eintr_wrapper.h" |
| 25 #include "base/third_party/valgrind/valgrind.h" | 24 #include "base/third_party/valgrind/valgrind.h" |
| 26 #include "sandbox/linux/bpf_dsl/codegen.h" | 25 #include "sandbox/linux/bpf_dsl/codegen.h" |
| 27 #include "sandbox/linux/bpf_dsl/policy.h" | 26 #include "sandbox/linux/bpf_dsl/policy.h" |
| 28 #include "sandbox/linux/bpf_dsl/policy_compiler.h" | 27 #include "sandbox/linux/bpf_dsl/policy_compiler.h" |
| 29 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" | 28 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" |
| 30 #include "sandbox/linux/bpf_dsl/syscall_set.h" | 29 #include "sandbox/linux/bpf_dsl/syscall_set.h" |
| 31 #include "sandbox/linux/seccomp-bpf/die.h" | 30 #include "sandbox/linux/seccomp-bpf/die.h" |
| 32 #include "sandbox/linux/seccomp-bpf/syscall.h" | 31 #include "sandbox/linux/seccomp-bpf/syscall.h" |
| 33 #include "sandbox/linux/seccomp-bpf/trap.h" | 32 #include "sandbox/linux/seccomp-bpf/trap.h" |
| 34 #include "sandbox/linux/services/proc_util.h" | 33 #include "sandbox/linux/services/proc_util.h" |
| 35 #include "sandbox/linux/services/syscall_wrappers.h" | 34 #include "sandbox/linux/services/syscall_wrappers.h" |
| 36 #include "sandbox/linux/services/thread_helpers.h" | 35 #include "sandbox/linux/services/thread_helpers.h" |
| 36 #include "sandbox/linux/system_headers/linux_filter.h" |
| 37 #include "sandbox/linux/system_headers/linux_seccomp.h" | 37 #include "sandbox/linux/system_headers/linux_seccomp.h" |
| 38 #include "sandbox/linux/system_headers/linux_syscalls.h" | 38 #include "sandbox/linux/system_headers/linux_syscalls.h" |
| 39 | 39 |
| 40 namespace sandbox { | 40 namespace sandbox { |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 bool IsRunningOnValgrind() { return RUNNING_ON_VALGRIND; } | 44 bool IsRunningOnValgrind() { return RUNNING_ON_VALGRIND; } |
| 45 | 45 |
| 46 bool IsSingleThreaded(int proc_fd) { | 46 bool IsSingleThreaded(int proc_fd) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } else { | 239 } else { |
| 240 if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) { | 240 if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) { |
| 241 SANDBOX_DIE("Kernel refuses to turn on BPF filters"); | 241 SANDBOX_DIE("Kernel refuses to turn on BPF filters"); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 sandbox_has_started_ = true; | 245 sandbox_has_started_ = true; |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace sandbox | 248 } // namespace sandbox |
| OLD | NEW |