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

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

Issue 11618010: Linux Sandbox: get everything to compile on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Proper boilerplate this time. Created 8 years 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
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/services/android_arm_ucontext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <sys/syscall.h> 5 #include <sys/syscall.h>
6 #include <sys/utsname.h> 6 #include <sys/utsname.h>
7 7
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" 11 #include "sandbox/linux/seccomp-bpf/bpf_tests.h"
12 #include "sandbox/linux/seccomp-bpf/syscall.h" 12 #include "sandbox/linux/seccomp-bpf/syscall.h"
13 #include "sandbox/linux/seccomp-bpf/verifier.h" 13 #include "sandbox/linux/seccomp-bpf/verifier.h"
14 #include "sandbox/linux/services/broker_process.h" 14 #include "sandbox/linux/services/broker_process.h"
15 #include "sandbox/linux/services/linux_syscalls.h" 15 #include "sandbox/linux/services/linux_syscalls.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 // Workaround for Android's prctl.h file.
19 #if !defined(PR_CAPBSET_READ)
20 #define PR_CAPBSET_READ 23
21 #define PR_CAPBSET_DROP 24
22 #endif
23
18 using namespace playground2; 24 using namespace playground2;
19 using sandbox::BrokerProcess; 25 using sandbox::BrokerProcess;
20 26
21 namespace { 27 namespace {
22 28
23 const int kExpectedReturnValue = 42; 29 const int kExpectedReturnValue = 42;
24 30
25 // This test should execute no matter whether we have kernel support. So, 31 // This test should execute no matter whether we have kernel support. So,
26 // we make it a TEST() instead of a BPF_TEST(). 32 // we make it a TEST() instead of a BPF_TEST().
27 TEST(SandboxBpf, CallSupports) { 33 TEST(SandboxBpf, CallSupports) {
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 DEATH_MESSAGE("Unexpected 64bit argument detected"), 961 DEATH_MESSAGE("Unexpected 64bit argument detected"),
956 EqualityWithNegativeArgumentsPolicy) { 962 EqualityWithNegativeArgumentsPolicy) {
957 // When expecting a 32bit system call argument, we look at the MSB of the 963 // When expecting a 32bit system call argument, we look at the MSB of the
958 // 64bit value and allow both "0" and "-1". But the latter is allowed only 964 // 64bit value and allow both "0" and "-1". But the latter is allowed only
959 // iff the LSB was negative. So, this death test should error out. 965 // iff the LSB was negative. So, this death test should error out.
960 BPF_ASSERT(SandboxSyscall(__NR_uname, 0xFFFFFFFF00000000ll) == -1); 966 BPF_ASSERT(SandboxSyscall(__NR_uname, 0xFFFFFFFF00000000ll) == -1);
961 } 967 }
962 #endif 968 #endif
963 969
964 } // namespace 970 } // namespace
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/services/android_arm_ucontext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698