Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: sandbox/linux/seccomp-bpf/sandbox_bpf.cc

Issue 1053603002: Introduce linux_filter.h and replace #include <linux/filter.h> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/linux/bpf_dsl/verifier.cc ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf_test_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « sandbox/linux/bpf_dsl/verifier.cc ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf_test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698