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

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

Issue 314903002: Linux sandbox: restrict futex operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nit Created 6 years, 6 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 | Annotate | Revision Log
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/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>
8 #include <sched.h> 9 #include <sched.h>
9 #include <signal.h> 10 #include <signal.h>
10 #include <string.h> 11 #include <string.h>
11 #include <sys/socket.h> 12 #include <sys/socket.h>
12 #include <sys/stat.h> 13 #include <sys/stat.h>
13 #include <sys/syscall.h> 14 #include <sys/syscall.h>
15 #include <sys/time.h>
14 #include <sys/types.h> 16 #include <sys/types.h>
15 #include <sys/wait.h> 17 #include <sys/wait.h>
16 #include <unistd.h> 18 #include <unistd.h>
17 19
18 #include "base/files/scoped_file.h" 20 #include "base/files/scoped_file.h"
19 #include "base/macros.h" 21 #include "base/macros.h"
20 #include "base/posix/eintr_wrapper.h" 22 #include "base/posix/eintr_wrapper.h"
21 #include "base/threading/thread.h" 23 #include "base/threading/thread.h"
22 #include "build/build_config.h" 24 #include "build/build_config.h"
23 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" 25 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
24 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" 26 #include "sandbox/linux/seccomp-bpf/bpf_tests.h"
25 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" 27 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
28 #include "sandbox/linux/services/android_futex.h"
26 #include "sandbox/linux/services/linux_syscalls.h" 29 #include "sandbox/linux/services/linux_syscalls.h"
27 #include "sandbox/linux/services/thread_helpers.h" 30 #include "sandbox/linux/services/thread_helpers.h"
28 #include "sandbox/linux/tests/unit_tests.h" 31 #include "sandbox/linux/tests/unit_tests.h"
29 32
30 namespace sandbox { 33 namespace sandbox {
31 34
32 namespace { 35 namespace {
33 36
34 // |pid| is the return value of a fork()-like call. This 37 // |pid| is the return value of a fork()-like call. This
35 // makes sure that if fork() succeeded the child exits 38 // makes sure that if fork() succeeded the child exits
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 TEST_BASELINE_SIGSYS(__NR_sysinfo); 237 TEST_BASELINE_SIGSYS(__NR_sysinfo);
235 TEST_BASELINE_SIGSYS(__NR_inotify_init); 238 TEST_BASELINE_SIGSYS(__NR_inotify_init);
236 TEST_BASELINE_SIGSYS(__NR_init_module); 239 TEST_BASELINE_SIGSYS(__NR_init_module);
237 TEST_BASELINE_SIGSYS(__NR_keyctl); 240 TEST_BASELINE_SIGSYS(__NR_keyctl);
238 TEST_BASELINE_SIGSYS(__NR_mq_open); 241 TEST_BASELINE_SIGSYS(__NR_mq_open);
239 TEST_BASELINE_SIGSYS(__NR_vserver); 242 TEST_BASELINE_SIGSYS(__NR_vserver);
240 TEST_BASELINE_SIGSYS(__NR_getcpu); 243 TEST_BASELINE_SIGSYS(__NR_getcpu);
241 TEST_BASELINE_SIGSYS(__NR_setpgid); 244 TEST_BASELINE_SIGSYS(__NR_setpgid);
242 TEST_BASELINE_SIGSYS(__NR_getitimer); 245 TEST_BASELINE_SIGSYS(__NR_getitimer);
243 246
247 #if !defined(OS_ANDROID)
248 BPF_DEATH_TEST_C(BaselinePolicy,
249 FutexWithRequeuePriorityInheritence,
250 DEATH_MESSAGE(GetFutexErrorMessageContentForTests()),
251 BaselinePolicy) {
252 syscall(__NR_futex, NULL, FUTEX_CMP_REQUEUE_PI, 0, NULL, NULL, 0);
253 _exit(1);
254 }
255
256 BPF_DEATH_TEST_C(BaselinePolicy,
257 FutexWithRequeuePriorityInheritencePrivate,
258 DEATH_MESSAGE(GetFutexErrorMessageContentForTests()),
259 BaselinePolicy) {
260 syscall(__NR_futex, NULL, FUTEX_CMP_REQUEUE_PI_PRIVATE, 0, NULL, NULL, 0);
261 _exit(1);
262 }
263 #endif // !defined(OS_ANDROID)
264
244 } // namespace 265 } // namespace
245 266
246 } // namespace sandbox 267 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc ('k') | sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698