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 <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/futex.h> | 9 #include <linux/futex.h> |
10 #include <sched.h> | 10 #include <sched.h> |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 BPF_TEST_C(BaselinePolicy, EPERM_getcwd, BaselinePolicy) { | 208 BPF_TEST_C(BaselinePolicy, EPERM_getcwd, BaselinePolicy) { |
209 errno = 0; | 209 errno = 0; |
210 char buf[1024]; | 210 char buf[1024]; |
211 char* cwd = getcwd(buf, sizeof(buf)); | 211 char* cwd = getcwd(buf, sizeof(buf)); |
212 BPF_ASSERT_EQ(NULL, cwd); | 212 BPF_ASSERT_EQ(NULL, cwd); |
213 BPF_ASSERT_EQ(EPERM, errno); | 213 BPF_ASSERT_EQ(EPERM, errno); |
214 } | 214 } |
215 | 215 |
| 216 // TODO(jorgelo): re-enable this after crbug.com/424973 is fixed. |
| 217 #if !defined(OS_CHROMEOS) |
216 BPF_DEATH_TEST_C(BaselinePolicy, | 218 BPF_DEATH_TEST_C(BaselinePolicy, |
217 SIGSYS_InvalidSyscall, | 219 SIGSYS_InvalidSyscall, |
218 DEATH_SEGV_MESSAGE(GetErrorMessageContentForTests()), | 220 DEATH_SEGV_MESSAGE(GetErrorMessageContentForTests()), |
219 BaselinePolicy) { | 221 BaselinePolicy) { |
220 Syscall::InvalidCall(); | 222 Syscall::InvalidCall(); |
221 } | 223 } |
| 224 #endif |
222 | 225 |
223 // A failing test using this macro could be problematic since we perform | 226 // A failing test using this macro could be problematic since we perform |
224 // system calls by passing "0" as every argument. | 227 // system calls by passing "0" as every argument. |
225 // The kernel could SIGSEGV the process or the system call itself could reboot | 228 // The kernel could SIGSEGV the process or the system call itself could reboot |
226 // the machine. Some thoughts have been given when hand-picking the system | 229 // the machine. Some thoughts have been given when hand-picking the system |
227 // calls below to limit any potential side effects outside of the current | 230 // calls below to limit any potential side effects outside of the current |
228 // process. | 231 // process. |
229 #define TEST_BASELINE_SIGSYS(sysno) \ | 232 #define TEST_BASELINE_SIGSYS(sysno) \ |
230 BPF_DEATH_TEST_C(BaselinePolicy, \ | 233 BPF_DEATH_TEST_C(BaselinePolicy, \ |
231 SIGSYS_##sysno, \ | 234 SIGSYS_##sysno, \ |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 ClockGettimeWithDisallowedClockCrashes, | 345 ClockGettimeWithDisallowedClockCrashes, |
343 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 346 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
344 BaselinePolicy) { | 347 BaselinePolicy) { |
345 struct timespec ts; | 348 struct timespec ts; |
346 clock_gettime(CLOCK_MONOTONIC_RAW, &ts); | 349 clock_gettime(CLOCK_MONOTONIC_RAW, &ts); |
347 } | 350 } |
348 | 351 |
349 } // namespace | 352 } // namespace |
350 | 353 |
351 } // namespace sandbox | 354 } // namespace sandbox |
OLD | NEW |