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 // Sanitizers internally use some syscalls which non-SFI NaCl disallows. | 5 // Sanitizers internally use some syscalls which non-SFI NaCl disallows. |
6 #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \ | 6 #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \ |
7 !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) | 7 !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) |
8 | 8 |
9 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" | 9 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 } | 193 } |
194 | 194 |
195 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, | 195 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, |
196 prctl_SET_DUMPABLE, | 196 prctl_SET_DUMPABLE, |
197 DEATH_SEGV_MESSAGE( | 197 DEATH_SEGV_MESSAGE( |
198 sandbox::GetPrctlErrorMessageContentForTests()), | 198 sandbox::GetPrctlErrorMessageContentForTests()), |
199 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 199 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
200 syscall(__NR_prctl, PR_SET_DUMPABLE, 1UL); | 200 syscall(__NR_prctl, PR_SET_DUMPABLE, 1UL); |
201 } | 201 } |
202 | 202 |
203 #if defined(OS_NACL_NONSFI) | 203 #if defined(OS_NACL_NONSFI) |
hidehiko
2015/05/27 18:40:33
Would you mind to change this condition to:
#if d
Sam Clegg
2015/05/27 18:44:52
Done.
| |
204 BPF_DEATH_TEST_C(NaClNonsfiSandboxTest, | 204 BPF_DEATH_TEST_C(NaClNonsfiSandboxTest, |
205 socketpair, | 205 socketpair, |
206 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 206 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
207 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 207 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
208 int tmp_fds[2]; | 208 int tmp_fds[2]; |
209 socketpair(AF_UNIX, SOCK_STREAM, 0, tmp_fds); | 209 socketpair(AF_UNIX, SOCK_STREAM, 0, tmp_fds); |
210 } | 210 } |
211 #else | 211 #else |
212 BPF_TEST_C(NaClNonSfiSandboxTest, | 212 BPF_TEST_C(NaClNonSfiSandboxTest, |
213 socketcall_allowed, | 213 socketcall_allowed, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | 386 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), |
387 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 387 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
388 #if defined(__i386__) | 388 #if defined(__i386__) |
389 uintptr_t args[] = {0, 0, 0}; | 389 uintptr_t args[] = {0, 0, 0}; |
390 syscall(__NR_socketcall, SYS_SOCKET, args); | 390 syscall(__NR_socketcall, SYS_SOCKET, args); |
391 #else | 391 #else |
392 syscall(__NR_socket, 0, 0, 0); | 392 syscall(__NR_socket, 0, 0, 0); |
393 #endif | 393 #endif |
394 } | 394 } |
395 | 395 |
396 #if defined(__x86_64__) || defined(__arm__) | |
397 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, | |
398 socketpair, | |
399 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()), | |
400 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | |
401 int fds[2]; | |
402 socketpair(AF_INET, SOCK_STREAM, 0, fds); | |
403 } | |
404 #endif | |
405 | |
406 BPF_TEST_C(NaClNonSfiSandboxTest, | 396 BPF_TEST_C(NaClNonSfiSandboxTest, |
407 fcntl_SETFD_allowed, | 397 fcntl_SETFD_allowed, |
408 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 398 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
409 base::ScopedFD fds[2]; | 399 base::ScopedFD fds[2]; |
410 DoPipe(fds); | 400 DoPipe(fds); |
411 BPF_ASSERT_EQ(0, fcntl(fds[0].get(), F_SETFD, FD_CLOEXEC)); | 401 BPF_ASSERT_EQ(0, fcntl(fds[0].get(), F_SETFD, FD_CLOEXEC)); |
412 } | 402 } |
413 | 403 |
414 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, | 404 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, |
415 fcntl_SETFD, | 405 fcntl_SETFD, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 RESTRICT_SYSCALL_EPERM_TEST(ptrace); | 664 RESTRICT_SYSCALL_EPERM_TEST(ptrace); |
675 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); | 665 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); |
676 #if defined(__i386__) || defined(__x86_64__) | 666 #if defined(__i386__) || defined(__x86_64__) |
677 RESTRICT_SYSCALL_EPERM_TEST(time); | 667 RESTRICT_SYSCALL_EPERM_TEST(time); |
678 #endif | 668 #endif |
679 | 669 |
680 } // namespace | 670 } // namespace |
681 | 671 |
682 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && | 672 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && |
683 // !MEMORY_SANITIZER && !LEAK_SANITIZER | 673 // !MEMORY_SANITIZER && !LEAK_SANITIZER |
OLD | NEW |