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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 | 86 |
87 BPF_DEATH_TEST_C(ParameterRestrictions, | 87 BPF_DEATH_TEST_C(ParameterRestrictions, |
88 clock_gettime_crash_monotonic_raw, | 88 clock_gettime_crash_monotonic_raw, |
89 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 89 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
90 RestrictClockIdPolicy) { | 90 RestrictClockIdPolicy) { |
91 struct timespec ts; | 91 struct timespec ts; |
92 clock_gettime(CLOCK_MONOTONIC_RAW, &ts); | 92 clock_gettime(CLOCK_MONOTONIC_RAW, &ts); |
93 } | 93 } |
94 | 94 |
95 #if defined(OS_LINUX) | |
96 | |
97 BPF_DEATH_TEST_C(ParameterRestrictions, | |
98 clock_gettime_crash_system_trace, | |
99 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | |
100 RestrictClockIdPolicy) { | |
101 struct timespec ts; | |
102 clock_gettime(base::TraceTicks::kClockSystemTrace, &ts); | |
103 } | |
104 | |
105 #endif // defined(OS_LINUX) | |
106 | |
107 #if !defined(OS_ANDROID) | 95 #if !defined(OS_ANDROID) |
108 BPF_DEATH_TEST_C(ParameterRestrictions, | 96 BPF_DEATH_TEST_C(ParameterRestrictions, |
109 clock_gettime_crash_cpu_clock, | 97 clock_gettime_crash_cpu_clock, |
110 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 98 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
111 RestrictClockIdPolicy) { | 99 RestrictClockIdPolicy) { |
112 // We can't use clock_getcpuclockid() because it's not implemented in newlib, | 100 // We can't use clock_getcpuclockid() because it's not implemented in newlib, |
113 // and it might not work inside the sandbox anyway. | 101 // and it might not work inside the sandbox anyway. |
114 const pid_t kInitPID = 1; | 102 const pid_t kInitPID = 1; |
115 const clockid_t kInitCPUClockID = | 103 const clockid_t kInitCPUClockID = |
116 MAKE_PROCESS_CPUCLOCK(kInitPID, CPUCLOCK_SCHED); | 104 MAKE_PROCESS_CPUCLOCK(kInitPID, CPUCLOCK_SCHED); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 getrusage_crash_not_self, | 227 getrusage_crash_not_self, |
240 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 228 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
241 RestrictGetrusagePolicy) { | 229 RestrictGetrusagePolicy) { |
242 struct rusage usage; | 230 struct rusage usage; |
243 getrusage(RUSAGE_CHILDREN, &usage); | 231 getrusage(RUSAGE_CHILDREN, &usage); |
244 } | 232 } |
245 | 233 |
246 } // namespace | 234 } // namespace |
247 | 235 |
248 } // namespace sandbox | 236 } // namespace sandbox |
OLD | NEW |