| 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 "sandbox/linux/seccomp-bpf-helpers/baseline_policy.h" | 5 #include "sandbox/linux/seccomp-bpf-helpers/baseline_policy.h" | 
| 6 | 6 | 
| 7 #include <errno.h> | 7 #include <errno.h> | 
|  | 8 #include <linux/futex.h> | 
|  | 9 #include <sched.h> | 
|  | 10 #include <signal.h> | 
|  | 11 #include <string.h> | 
|  | 12 #include <sys/socket.h> | 
| 8 #include <sys/stat.h> | 13 #include <sys/stat.h> | 
| 9 #include <sys/syscall.h> | 14 #include <sys/syscall.h> | 
|  | 15 #include <sys/time.h> | 
| 10 #include <sys/types.h> | 16 #include <sys/types.h> | 
| 11 #include <sys/wait.h> | 17 #include <sys/wait.h> | 
| 12 #include <unistd.h> | 18 #include <unistd.h> | 
| 13 | 19 | 
| 14 #include "base/posix/eintr_wrapper.h" | 20 #include "base/posix/eintr_wrapper.h" | 
| 15 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" | 
| 16 #include "build/build_config.h" | 22 #include "build/build_config.h" | 
| 17 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 23 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 
| 18 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" | 24 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" | 
| 19 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 25 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 
|  | 26 #include "sandbox/linux/services/android_futex.h" | 
| 20 #include "sandbox/linux/services/linux_syscalls.h" | 27 #include "sandbox/linux/services/linux_syscalls.h" | 
| 21 #include "sandbox/linux/services/thread_helpers.h" | 28 #include "sandbox/linux/services/thread_helpers.h" | 
| 22 #include "sandbox/linux/tests/unit_tests.h" | 29 #include "sandbox/linux/tests/unit_tests.h" | 
| 23 | 30 | 
| 24 namespace sandbox { | 31 namespace sandbox { | 
| 25 | 32 | 
| 26 namespace { | 33 namespace { | 
| 27 | 34 | 
| 28 // |pid| is the return value of a fork()-like call. This | 35 // |pid| is the return value of a fork()-like call. This | 
| 29 // makes sure that if fork() succeeded the child exits | 36 // makes sure that if fork() succeeded the child exits | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103 BPF_DEATH_TEST_C(BaselinePolicy, | 110 BPF_DEATH_TEST_C(BaselinePolicy, | 
| 104                  DisallowedCloneFlagCrashes, | 111                  DisallowedCloneFlagCrashes, | 
| 105                  DEATH_MESSAGE(GetCloneErrorMessageContentForTests()), | 112                  DEATH_MESSAGE(GetCloneErrorMessageContentForTests()), | 
| 106                  BaselinePolicy) { | 113                  BaselinePolicy) { | 
| 107   pid_t pid = syscall(__NR_clone, CLONE_THREAD | SIGCHLD); | 114   pid_t pid = syscall(__NR_clone, CLONE_THREAD | SIGCHLD); | 
| 108   HandlePostForkReturn(pid); | 115   HandlePostForkReturn(pid); | 
| 109 } | 116 } | 
| 110 | 117 | 
| 111 #endif  // !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) | 118 #endif  // !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) | 
| 112 | 119 | 
|  | 120 #if !defined(OS_ANDROID) | 
|  | 121 BPF_DEATH_TEST_C(BaselinePolicy, | 
|  | 122                  FutexWithRequeuePriorityInheritence, | 
|  | 123                  DEATH_MESSAGE(GetFutexErrorMessageContentForTests()), | 
|  | 124                  BaselinePolicy) { | 
|  | 125   syscall(__NR_futex, NULL, FUTEX_CMP_REQUEUE_PI, 0, NULL, NULL, 0); | 
|  | 126   _exit(1); | 
|  | 127 } | 
|  | 128 | 
|  | 129 BPF_DEATH_TEST_C(BaselinePolicy, | 
|  | 130                  FutexWithRequeuePriorityInheritencePrivate, | 
|  | 131                  DEATH_MESSAGE(GetFutexErrorMessageContentForTests()), | 
|  | 132                  BaselinePolicy) { | 
|  | 133   syscall(__NR_futex, NULL, FUTEX_CMP_REQUEUE_PI_PRIVATE, 0, NULL, NULL, 0); | 
|  | 134   _exit(1); | 
|  | 135 } | 
|  | 136 #endif  // !defined(OS_ANDROID) | 
|  | 137 | 
| 113 }  // namespace | 138 }  // namespace | 
| 114 | 139 | 
| 115 }  // namespace sandbox | 140 }  // namespace sandbox | 
| OLD | NEW | 
|---|