Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: components/nacl/loader/nonsfi/nonsfi_sandbox.cc

Issue 570763002: Remove more dependencies on sandbox/linux/seccomp-bpf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <linux/futex.h> 9 #include <linux/futex.h>
10 #include <linux/net.h> 10 #include <linux/net.h>
11 #include <sys/mman.h> 11 #include <sys/mman.h>
12 #include <sys/prctl.h> 12 #include <sys/prctl.h>
13 #include <sys/ptrace.h> 13 #include <sys/ptrace.h>
14 #include <sys/socket.h> 14 #include <sys/socket.h>
15 #include <sys/syscall.h> 15 #include <sys/syscall.h>
16 #include <sys/time.h> 16 #include <sys/time.h>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "content/public/common/sandbox_init.h" 22 #include "content/public/common/sandbox_init.h"
23 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" 23 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
24 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" 24 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
25 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" 25 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
26 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h"
27 #include "sandbox/linux/services/linux_syscalls.h" 26 #include "sandbox/linux/services/linux_syscalls.h"
28 27
29 #if defined(__arm__) && !defined(MAP_STACK) 28 #if defined(__arm__) && !defined(MAP_STACK)
30 // Chrome OS Daisy (ARM) build environment has old headers. 29 // Chrome OS Daisy (ARM) build environment has old headers.
31 #define MAP_STACK 0x20000 30 #define MAP_STACK 0x20000
32 #endif 31 #endif
33 32
34 #define CASES SANDBOX_BPF_DSL_CASES 33 #define CASES SANDBOX_BPF_DSL_CASES
35 34
36 using sandbox::CrashSIGSYS; 35 using sandbox::CrashSIGSYS;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 return CrashSIGSYS(); 296 return CrashSIGSYS();
298 } 297 }
299 } 298 }
300 299
301 ResultExpr NaClNonSfiBPFSandboxPolicy::InvalidSyscall() const { 300 ResultExpr NaClNonSfiBPFSandboxPolicy::InvalidSyscall() const {
302 return CrashSIGSYS(); 301 return CrashSIGSYS();
303 } 302 }
304 303
305 bool InitializeBPFSandbox() { 304 bool InitializeBPFSandbox() {
306 bool sandbox_is_initialized = content::InitializeSandbox( 305 bool sandbox_is_initialized = content::InitializeSandbox(
307 scoped_ptr<sandbox::SandboxBPFPolicy>( 306 scoped_ptr<sandbox::bpf_dsl::SandboxBPFDSLPolicy>(
308 new nacl::nonsfi::NaClNonSfiBPFSandboxPolicy())); 307 new nacl::nonsfi::NaClNonSfiBPFSandboxPolicy()));
309 if (!sandbox_is_initialized) 308 if (!sandbox_is_initialized)
310 return false; 309 return false;
311 RunSandboxSanityChecks(); 310 RunSandboxSanityChecks();
312 return true; 311 return true;
313 } 312 }
314 313
315 } // namespace nonsfi 314 } // namespace nonsfi
316 } // namespace nacl 315 } // namespace nacl
OLDNEW
« no previous file with comments | « no previous file | components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698