Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc

Issue 569633002: Linux sandbox: fix MIPS Android compilation bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <time.h> 7 #include <time.h>
8 8
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" 12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
13 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" 13 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
14 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" 14 #include "sandbox/linux/seccomp-bpf/bpf_tests.h"
15 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" 15 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
16 #include "sandbox/linux/seccomp-bpf/syscall.h" 16 #include "sandbox/linux/seccomp-bpf/syscall.h"
17 #include "sandbox/linux/services/linux_syscalls.h" 17 #include "sandbox/linux/services/linux_syscalls.h"
18 #include "sandbox/linux/tests/unit_tests.h" 18 #include "sandbox/linux/tests/unit_tests.h"
19
20 #if !defined(OS_ANDROID)
19 #include "third_party/lss/linux_syscall_support.h" // for MAKE_PROCESS_CPUCLOCK 21 #include "third_party/lss/linux_syscall_support.h" // for MAKE_PROCESS_CPUCLOCK
22 #endif
20 23
21 namespace sandbox { 24 namespace sandbox {
22 25
23 namespace { 26 namespace {
24 27
25 // NOTE: most of the parameter restrictions are tested in 28 // NOTE: most of the parameter restrictions are tested in
26 // baseline_policy_unittest.cc as a more end-to-end test. 29 // baseline_policy_unittest.cc as a more end-to-end test.
27 30
28 using sandbox::bpf_dsl::Allow; 31 using sandbox::bpf_dsl::Allow;
29 using sandbox::bpf_dsl::ResultExpr; 32 using sandbox::bpf_dsl::ResultExpr;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 BPF_DEATH_TEST_C(ParameterRestrictions, 113 BPF_DEATH_TEST_C(ParameterRestrictions,
111 clock_gettime_crash_system_trace, 114 clock_gettime_crash_system_trace,
112 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), 115 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()),
113 RestrictClockIdPolicy) { 116 RestrictClockIdPolicy) {
114 struct timespec ts; 117 struct timespec ts;
115 clock_gettime(base::TimeTicks::kClockSystemTrace, &ts); 118 clock_gettime(base::TimeTicks::kClockSystemTrace, &ts);
116 } 119 }
117 120
118 #endif // defined(OS_CHROMEOS) 121 #endif // defined(OS_CHROMEOS)
119 122
123 #if !defined(OS_ANDROID)
120 BPF_DEATH_TEST_C(ParameterRestrictions, 124 BPF_DEATH_TEST_C(ParameterRestrictions,
121 clock_gettime_crash_cpu_clock, 125 clock_gettime_crash_cpu_clock,
122 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), 126 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()),
123 RestrictClockIdPolicy) { 127 RestrictClockIdPolicy) {
124 // We can't use clock_getcpuclockid() because it's not implemented in newlib, 128 // We can't use clock_getcpuclockid() because it's not implemented in newlib,
125 // and it might not work inside the sandbox anyway. 129 // and it might not work inside the sandbox anyway.
126 const pid_t kInitPID = 1; 130 const pid_t kInitPID = 1;
127 const clockid_t kInitCPUClockID = 131 const clockid_t kInitCPUClockID =
128 MAKE_PROCESS_CPUCLOCK(kInitPID, CPUCLOCK_SCHED); 132 MAKE_PROCESS_CPUCLOCK(kInitPID, CPUCLOCK_SCHED);
129 133
130 struct timespec ts; 134 struct timespec ts;
131 clock_gettime(kInitCPUClockID, &ts); 135 clock_gettime(kInitCPUClockID, &ts);
132 } 136 }
137 #endif // !defined(OS_ANDROID)
133 138
134 } // namespace 139 } // namespace
135 140
136 } // namespace sandbox 141 } // namespace sandbox
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698