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 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" | 5 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <sched.h> | 10 #include <sched.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 #include "base/bind.h" | 23 #include "base/bind.h" |
24 #include "base/callback.h" | 24 #include "base/callback.h" |
25 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
26 #include "base/files/scoped_file.h" | 26 #include "base/files/scoped_file.h" |
27 #include "base/logging.h" | 27 #include "base/logging.h" |
28 #include "base/posix/eintr_wrapper.h" | 28 #include "base/posix/eintr_wrapper.h" |
29 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 29 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
30 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" | 30 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" |
31 | 31 |
| 32 // This is a hack. TODO(hamaji), fix crbug.com/364751. |
| 33 namespace sandbox { |
| 34 extern const bool kAllowForkWithThreads = true; |
| 35 } |
| 36 |
32 namespace { | 37 namespace { |
33 | 38 |
34 void DoPipe(base::ScopedFD* fds) { | 39 void DoPipe(base::ScopedFD* fds) { |
35 int tmp_fds[2]; | 40 int tmp_fds[2]; |
36 BPF_ASSERT_EQ(0, pipe(tmp_fds)); | 41 BPF_ASSERT_EQ(0, pipe(tmp_fds)); |
37 fds[0].reset(tmp_fds[0]); | 42 fds[0].reset(tmp_fds[0]); |
38 fds[1].reset(tmp_fds[1]); | 43 fds[1].reset(tmp_fds[1]); |
39 } | 44 } |
40 | 45 |
41 void DoSocketpair(base::ScopedFD* fds) { | 46 void DoSocketpair(base::ScopedFD* fds) { |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 #if defined(__i386__) || defined(__x86_64__) | 482 #if defined(__i386__) || defined(__x86_64__) |
478 BPF_TEST(NaClNonSfiSandboxTest, time_EPERM, | 483 BPF_TEST(NaClNonSfiSandboxTest, time_EPERM, |
479 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) { | 484 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) { |
480 errno = 0; | 485 errno = 0; |
481 BPF_ASSERT_EQ(-1, syscall(__NR_time)); | 486 BPF_ASSERT_EQ(-1, syscall(__NR_time)); |
482 BPF_ASSERT_EQ(EPERM, errno); | 487 BPF_ASSERT_EQ(EPERM, errno); |
483 } | 488 } |
484 #endif | 489 #endif |
485 | 490 |
486 } // namespace | 491 } // namespace |
OLD | NEW |