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/syscall_parameters_restrictions.h" | 5 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <sched.h> | 8 #include <sched.h> |
9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 errno = 0; | 150 errno = 0; |
151 BPF_ASSERT_EQ(-1, sched_getparam(tid, NULL)); | 151 BPF_ASSERT_EQ(-1, sched_getparam(tid, NULL)); |
152 BPF_ASSERT_EQ(EINVAL, errno); | 152 BPF_ASSERT_EQ(EINVAL, errno); |
153 | 153 |
154 thread_run->Signal(); | 154 thread_run->Signal(); |
155 } | 155 } |
156 | 156 |
157 BPF_TEST_C(ParameterRestrictions, | 157 BPF_TEST_C(ParameterRestrictions, |
158 sched_getparam_allowed, | 158 sched_getparam_allowed, |
159 RestrictSchedPolicy) { | 159 RestrictSchedPolicy) { |
160 base::WaitableEvent thread_run(true, false); | 160 base::WaitableEvent thread_run( |
| 161 base::WaitableEvent::ResetPolicy::MANUAL, |
| 162 base::WaitableEvent::InitialState::NOT_SIGNALED); |
161 // Run the actual test in a new thread so that the current pid and tid are | 163 // Run the actual test in a new thread so that the current pid and tid are |
162 // different. | 164 // different. |
163 base::Thread getparam_thread("sched_getparam_thread"); | 165 base::Thread getparam_thread("sched_getparam_thread"); |
164 BPF_ASSERT(getparam_thread.Start()); | 166 BPF_ASSERT(getparam_thread.Start()); |
165 getparam_thread.message_loop()->PostTask( | 167 getparam_thread.message_loop()->PostTask( |
166 FROM_HERE, base::Bind(&SchedGetParamThread, &thread_run)); | 168 FROM_HERE, base::Bind(&SchedGetParamThread, &thread_run)); |
167 BPF_ASSERT(thread_run.TimedWait(base::TimeDelta::FromMilliseconds(5000))); | 169 BPF_ASSERT(thread_run.TimedWait(base::TimeDelta::FromMilliseconds(5000))); |
168 getparam_thread.Stop(); | 170 getparam_thread.Stop(); |
169 } | 171 } |
170 | 172 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 getrusage_crash_not_self, | 232 getrusage_crash_not_self, |
231 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 233 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
232 RestrictGetrusagePolicy) { | 234 RestrictGetrusagePolicy) { |
233 struct rusage usage; | 235 struct rusage usage; |
234 getrusage(RUSAGE_CHILDREN, &usage); | 236 getrusage(RUSAGE_CHILDREN, &usage); |
235 } | 237 } |
236 | 238 |
237 } // namespace | 239 } // namespace |
238 | 240 |
239 } // namespace sandbox | 241 } // namespace sandbox |
OLD | NEW |