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

Unified Diff: components/nacl/loader/nonsfi/nonsfi_sandbox.h

Issue 196793023: Add seccomp sandbox for non-SFI NaCl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/loader/nonsfi/DEPS ('k') | components/nacl/loader/nonsfi/nonsfi_sandbox.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nonsfi/nonsfi_sandbox.h
diff --git a/components/nacl/loader/nonsfi/nonsfi_sandbox.h b/components/nacl/loader/nonsfi/nonsfi_sandbox.h
new file mode 100644
index 0000000000000000000000000000000000000000..28e9cff8fe14e476006a5e03a088cd77140ed1f2
--- /dev/null
+++ b/components/nacl/loader/nonsfi/nonsfi_sandbox.h
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_NACL_LOADER_NONSFI_NONSFI_SANDBOX_H_
+#define COMPONENTS_NACL_LOADER_NONSFI_NONSFI_SANDBOX_H_
+
+#include "base/basictypes.h"
+#include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h"
+
+namespace nacl {
+namespace nonsfi {
+
+// The seccomp sandbox policy for NaCl non-SFI mode. Note that this
+// policy must be as strong as possible, as non-SFI mode heavily
+// depends on seccomp sandbox.
+class NaClNonSfiBPFSandboxPolicy : public sandbox::SandboxBPFPolicy {
+ public:
+ explicit NaClNonSfiBPFSandboxPolicy() {}
+ virtual ~NaClNonSfiBPFSandboxPolicy() {}
+
+ virtual sandbox::ErrorCode EvaluateSyscall(sandbox::SandboxBPF* sb,
+ int sysno) const OVERRIDE;
+
+ static sandbox::ErrorCode EvaluateSyscallImpl(sandbox::SandboxBPF* sb,
+ int sysno, void*);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaClNonSfiBPFSandboxPolicy);
+};
+
+// Initializes seccomp-bpf sandbox for non-SFI NaCl. Returns false on
+// failure.
+bool InitializeBPFSandbox();
+
+} // namespace nonsfi
+} // namespace nacl
+
+#endif // COMPONENTS_NACL_LOADER_NONSFI_NONSFI_SANDBOX_H_
« no previous file with comments | « components/nacl/loader/nonsfi/DEPS ('k') | components/nacl/loader/nonsfi/nonsfi_sandbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698