Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / components / nacl / loader / nonsfi / nonsfi_sandbox.h
blob44004be66030822d4b76314bcbfe59d14342d15a
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_NACL_LOADER_NONSFI_NONSFI_SANDBOX_H_
6 #define COMPONENTS_NACL_LOADER_NONSFI_NONSFI_SANDBOX_H_
8 #include "base/basictypes.h"
9 #include "base/files/scoped_file.h"
10 #include "sandbox/linux/bpf_dsl/bpf_dsl_forward.h"
11 #include "sandbox/linux/bpf_dsl/policy.h"
13 namespace nacl {
14 namespace nonsfi {
16 // The seccomp sandbox policy for NaCl non-SFI mode. Note that this
17 // policy must be as strong as possible, as non-SFI mode heavily
18 // depends on seccomp sandbox.
19 class NaClNonSfiBPFSandboxPolicy : public sandbox::bpf_dsl::Policy {
20 public:
21 explicit NaClNonSfiBPFSandboxPolicy();
22 ~NaClNonSfiBPFSandboxPolicy() override;
24 sandbox::bpf_dsl::ResultExpr EvaluateSyscall(int sysno) const override;
25 sandbox::bpf_dsl::ResultExpr InvalidSyscall() const override;
27 private:
28 // The PID that the policy applies to (should be equal to the current pid).
29 const pid_t policy_pid_;
31 DISALLOW_COPY_AND_ASSIGN(NaClNonSfiBPFSandboxPolicy);
34 // Initializes seccomp-bpf sandbox for non-SFI NaCl. Returns false on
35 // failure.
36 bool InitializeBPFSandbox(base::ScopedFD proc_fd);
38 } // namespace nonsfi
39 } // namespace nacl
41 #endif // COMPONENTS_NACL_LOADER_NONSFI_NONSFI_SANDBOX_H_