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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 DEATH_SEGV_MESSAGE( | 481 DEATH_SEGV_MESSAGE( |
482 sandbox::GetFutexErrorMessageContentForTests()), | 482 sandbox::GetFutexErrorMessageContentForTests()), |
483 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 483 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
484 syscall(__NR_futex, NULL, FUTEX_CMP_REQUEUE_PI_PRIVATE, 0, NULL, NULL, 0); | 484 syscall(__NR_futex, NULL, FUTEX_CMP_REQUEUE_PI_PRIVATE, 0, NULL, NULL, 0); |
485 _exit(1); | 485 _exit(1); |
486 } | 486 } |
487 | 487 |
488 BPF_TEST_C(NaClNonSfiSandboxTest, | 488 BPF_TEST_C(NaClNonSfiSandboxTest, |
489 StartingAndJoiningThreadWorks, | 489 StartingAndJoiningThreadWorks, |
490 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 490 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
491 #if defined(OS_NACL_NONSFI) | |
492 // base::Thread internally uses LazyInstance, which registers a callback to | |
493 // AtExitManager. However, in PNaCl toolchain build, it is not instantiated | |
494 // by the test runner, unlike host toolchain build (nacl_loader_unittests). | |
495 // Hence, declare it here so that the LazyInstance will work properly. | |
496 base::AtExitManager at_exit; | |
497 #endif | |
498 | |
499 base::Thread thread("sandbox_tests"); | 491 base::Thread thread("sandbox_tests"); |
500 BPF_ASSERT(thread.Start()); | 492 BPF_ASSERT(thread.Start()); |
501 // |thread|'s destructor will join the thread. | 493 // |thread|'s destructor will join the thread. |
502 } | 494 } |
503 | 495 |
504 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, | 496 BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, |
505 FutexWithUnlockPIPrivate, | 497 FutexWithUnlockPIPrivate, |
506 DEATH_SEGV_MESSAGE( | 498 DEATH_SEGV_MESSAGE( |
507 sandbox::GetFutexErrorMessageContentForTests()), | 499 sandbox::GetFutexErrorMessageContentForTests()), |
508 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { | 500 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 RESTRICT_SYSCALL_EPERM_TEST(ptrace); | 669 RESTRICT_SYSCALL_EPERM_TEST(ptrace); |
678 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); | 670 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); |
679 #if defined(__i386__) || defined(__x86_64__) | 671 #if defined(__i386__) || defined(__x86_64__) |
680 RESTRICT_SYSCALL_EPERM_TEST(time); | 672 RESTRICT_SYSCALL_EPERM_TEST(time); |
681 #endif | 673 #endif |
682 | 674 |
683 } // namespace | 675 } // namespace |
684 | 676 |
685 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && | 677 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && |
686 // !MEMORY_SANITIZER && !LEAK_SANITIZER | 678 // !MEMORY_SANITIZER && !LEAK_SANITIZER |
OLD | NEW |