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

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

Issue 733303004: Linux sandbox: change API to start the sandbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits from Jorge. Created 6 years 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
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>
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (IsGracefullyDenied(sysno)) 293 if (IsGracefullyDenied(sysno))
294 return Error(EPERM); 294 return Error(EPERM);
295 return CrashSIGSYS(); 295 return CrashSIGSYS();
296 } 296 }
297 } 297 }
298 298
299 ResultExpr NaClNonSfiBPFSandboxPolicy::InvalidSyscall() const { 299 ResultExpr NaClNonSfiBPFSandboxPolicy::InvalidSyscall() const {
300 return CrashSIGSYS(); 300 return CrashSIGSYS();
301 } 301 }
302 302
303 bool InitializeBPFSandbox() { 303 bool InitializeBPFSandbox(base::ScopedFD proc_task_fd) {
304 bool sandbox_is_initialized = 304 bool sandbox_is_initialized = content::InitializeSandbox(
305 content::InitializeSandbox(scoped_ptr<sandbox::bpf_dsl::Policy>( 305 scoped_ptr<sandbox::bpf_dsl::Policy>(
306 new nacl::nonsfi::NaClNonSfiBPFSandboxPolicy())); 306 new nacl::nonsfi::NaClNonSfiBPFSandboxPolicy()),
307 proc_task_fd.Pass());
307 if (!sandbox_is_initialized) 308 if (!sandbox_is_initialized)
308 return false; 309 return false;
309 RunSandboxSanityChecks(); 310 RunSandboxSanityChecks();
310 return true; 311 return true;
311 } 312 }
312 313
313 } // namespace nonsfi 314 } // namespace nonsfi
314 } // namespace nacl 315 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_sandbox.h ('k') | components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698