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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 namespace { | 107 namespace { |
108 | 108 |
109 void DoPipe(base::ScopedFD* fds) { | 109 void DoPipe(base::ScopedFD* fds) { |
110 int tmp_fds[2]; | 110 int tmp_fds[2]; |
111 BPF_ASSERT_EQ(0, pipe(tmp_fds)); | 111 BPF_ASSERT_EQ(0, pipe(tmp_fds)); |
112 fds[0].reset(tmp_fds[0]); | 112 fds[0].reset(tmp_fds[0]); |
113 fds[1].reset(tmp_fds[1]); | 113 fds[1].reset(tmp_fds[1]); |
114 } | 114 } |
115 | 115 |
116 void DoSocketpair(base::ScopedFD* fds) { | |
117 int tmp_fds[2]; | |
118 BPF_ASSERT_EQ(0, socketpair(AF_UNIX, SOCK_STREAM, 0, tmp_fds)); | |
119 fds[0].reset(tmp_fds[0]); | |
120 fds[1].reset(tmp_fds[1]); | |
121 } | |
122 | |
123 TEST(NaClNonSfiSandboxTest, BPFIsSupported) { | 116 TEST(NaClNonSfiSandboxTest, BPFIsSupported) { |
124 bool seccomp_bpf_supported = sandbox::SandboxBPF::SupportsSeccompSandbox( | 117 bool seccomp_bpf_supported = sandbox::SandboxBPF::SupportsSeccompSandbox( |
125 sandbox::SandboxBPF::SeccompLevel::SINGLE_THREADED); | 118 sandbox::SandboxBPF::SeccompLevel::SINGLE_THREADED); |
126 | 119 |
127 if (!seccomp_bpf_supported) { | 120 if (!seccomp_bpf_supported) { |
128 LOG(ERROR) << "Seccomp BPF is not supported, these tests " | 121 LOG(ERROR) << "Seccomp BPF is not supported, these tests " |
129 << "will pass without running"; | 122 << "will pass without running"; |
130 } | 123 } |
131 } | 124 } |
132 | 125 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 RESTRICT_SYSCALL_EPERM_TEST(ptrace); | 693 RESTRICT_SYSCALL_EPERM_TEST(ptrace); |
701 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); | 694 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); |
702 #if defined(__i386__) || defined(__x86_64__) | 695 #if defined(__i386__) || defined(__x86_64__) |
703 RESTRICT_SYSCALL_EPERM_TEST(time); | 696 RESTRICT_SYSCALL_EPERM_TEST(time); |
704 #endif | 697 #endif |
705 | 698 |
706 } // namespace | 699 } // namespace |
707 | 700 |
708 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && | 701 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && |
709 // !MEMORY_SANITIZER && !LEAK_SANITIZER | 702 // !MEMORY_SANITIZER && !LEAK_SANITIZER |
OLD | NEW |