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/bpf_dsl/bpf_dsl.h" |
| 6 |
5 #include <errno.h> | 7 #include <errno.h> |
6 #include <pthread.h> | 8 #include <pthread.h> |
7 #include <sched.h> | 9 #include <sched.h> |
8 #include <signal.h> | 10 #include <signal.h> |
9 #include <sys/prctl.h> | 11 #include <sys/prctl.h> |
10 #include <sys/ptrace.h> | 12 #include <sys/ptrace.h> |
11 #include <sys/syscall.h> | 13 #include <sys/syscall.h> |
12 #include <sys/time.h> | 14 #include <sys/time.h> |
13 #include <sys/types.h> | 15 #include <sys/types.h> |
14 #include <sys/utsname.h> | 16 #include <sys/utsname.h> |
15 #include <unistd.h> | 17 #include <unistd.h> |
16 #include <sys/socket.h> | 18 #include <sys/socket.h> |
17 | 19 |
18 #if defined(ANDROID) | 20 #if defined(ANDROID) |
19 // Work-around for buggy headers in Android's NDK | 21 // Work-around for buggy headers in Android's NDK |
20 #define __user | 22 #define __user |
21 #endif | 23 #endif |
22 #include <linux/futex.h> | 24 #include <linux/futex.h> |
23 | 25 |
24 #include <ostream> | |
25 | |
26 #include "base/bind.h" | 26 #include "base/bind.h" |
27 #include "base/logging.h" | 27 #include "base/logging.h" |
28 #include "base/macros.h" | 28 #include "base/macros.h" |
29 #include "base/memory/scoped_ptr.h" | 29 #include "base/memory/scoped_ptr.h" |
30 #include "base/posix/eintr_wrapper.h" | 30 #include "base/posix/eintr_wrapper.h" |
31 #include "base/synchronization/waitable_event.h" | 31 #include "base/synchronization/waitable_event.h" |
32 #include "base/threading/thread.h" | 32 #include "base/threading/thread.h" |
33 #include "build/build_config.h" | 33 #include "build/build_config.h" |
34 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | |
35 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" | 34 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" |
| 35 #include "sandbox/linux/seccomp-bpf/die.h" |
| 36 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" |
36 #include "sandbox/linux/seccomp-bpf/syscall.h" | 37 #include "sandbox/linux/seccomp-bpf/syscall.h" |
37 #include "sandbox/linux/seccomp-bpf/trap.h" | 38 #include "sandbox/linux/seccomp-bpf/trap.h" |
38 #include "sandbox/linux/seccomp-bpf/verifier.h" | |
39 #include "sandbox/linux/services/broker_process.h" | 39 #include "sandbox/linux/services/broker_process.h" |
40 #include "sandbox/linux/services/linux_syscalls.h" | 40 #include "sandbox/linux/services/linux_syscalls.h" |
41 #include "sandbox/linux/tests/scoped_temporary_file.h" | 41 #include "sandbox/linux/tests/scoped_temporary_file.h" |
42 #include "sandbox/linux/tests/unit_tests.h" | 42 #include "sandbox/linux/tests/unit_tests.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
44 | 44 |
45 // Workaround for Android's prctl.h file. | 45 // Workaround for Android's prctl.h file. |
46 #ifndef PR_GET_ENDIAN | 46 #ifndef PR_GET_ENDIAN |
47 #define PR_GET_ENDIAN 19 | 47 #define PR_GET_ENDIAN 19 |
48 #endif | 48 #endif |
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 BPF_ASSERT_EQ(ENOSYS, errno); | 2362 BPF_ASSERT_EQ(ENOSYS, errno); |
2363 | 2363 |
2364 BPF_ASSERT_EQ(-1, syscall(__NR_setgid, 300)); | 2364 BPF_ASSERT_EQ(-1, syscall(__NR_setgid, 300)); |
2365 BPF_ASSERT_EQ(EPERM, errno); | 2365 BPF_ASSERT_EQ(EPERM, errno); |
2366 } | 2366 } |
2367 | 2367 |
2368 } // namespace | 2368 } // namespace |
2369 | 2369 |
2370 } // namespace bpf_dsl | 2370 } // namespace bpf_dsl |
2371 } // namespace sandbox | 2371 } // namespace sandbox |
OLD | NEW |