OLD | NEW |
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/prctl.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 "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 using namespace playground2; | 18 using namespace playground2; |
18 using sandbox::BrokerProcess; | 19 using sandbox::BrokerProcess; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 const int kExpectedReturnValue = 42; | 23 const int kExpectedReturnValue = 42; |
23 | 24 |
24 // This test should execute no matter whether we have kernel support. So, | 25 // This test should execute no matter whether we have kernel support. So, |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 DEATH_MESSAGE("Unexpected 64bit argument detected"), | 955 DEATH_MESSAGE("Unexpected 64bit argument detected"), |
955 EqualityWithNegativeArgumentsPolicy) { | 956 EqualityWithNegativeArgumentsPolicy) { |
956 // When expecting a 32bit system call argument, we look at the MSB of the | 957 // When expecting a 32bit system call argument, we look at the MSB of the |
957 // 64bit value and allow both "0" and "-1". But the latter is allowed only | 958 // 64bit value and allow both "0" and "-1". But the latter is allowed only |
958 // iff the LSB was negative. So, this death test should error out. | 959 // iff the LSB was negative. So, this death test should error out. |
959 BPF_ASSERT(SandboxSyscall(__NR_uname, 0xFFFFFFFF00000000ll) == -1); | 960 BPF_ASSERT(SandboxSyscall(__NR_uname, 0xFFFFFFFF00000000ll) == -1); |
960 } | 961 } |
961 #endif | 962 #endif |
962 | 963 |
963 } // namespace | 964 } // namespace |
OLD | NEW |