| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sandbox_linux/nacl_bpf_sandbox_linux.h" | 5 #include "components/nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(USE_SECCOMP_BPF) | 9 #if defined(USE_SECCOMP_BPF) |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 using sandbox::bpf_dsl::Allow; | 33 using sandbox::bpf_dsl::Allow; |
| 34 using sandbox::bpf_dsl::Error; | 34 using sandbox::bpf_dsl::Error; |
| 35 using sandbox::bpf_dsl::ResultExpr; | 35 using sandbox::bpf_dsl::ResultExpr; |
| 36 | 36 |
| 37 class NaClBPFSandboxPolicy : public sandbox::bpf_dsl::Policy { | 37 class NaClBPFSandboxPolicy : public sandbox::bpf_dsl::Policy { |
| 38 public: | 38 public: |
| 39 NaClBPFSandboxPolicy() | 39 NaClBPFSandboxPolicy() |
| 40 : baseline_policy_(content::GetBPFSandboxBaselinePolicy()) {} | 40 : baseline_policy_(content::GetBPFSandboxBaselinePolicy()) {} |
| 41 virtual ~NaClBPFSandboxPolicy() {} | 41 ~NaClBPFSandboxPolicy() override {} |
| 42 | 42 |
| 43 virtual ResultExpr EvaluateSyscall(int system_call_number) const override; | 43 ResultExpr EvaluateSyscall(int system_call_number) const override; |
| 44 virtual ResultExpr InvalidSyscall() const override { | 44 ResultExpr InvalidSyscall() const override { |
| 45 return baseline_policy_->InvalidSyscall(); | 45 return baseline_policy_->InvalidSyscall(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 scoped_ptr<sandbox::bpf_dsl::Policy> baseline_policy_; | 49 scoped_ptr<sandbox::bpf_dsl::Policy> baseline_policy_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(NaClBPFSandboxPolicy); | 51 DISALLOW_COPY_AND_ASSIGN(NaClBPFSandboxPolicy); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 ResultExpr NaClBPFSandboxPolicy::EvaluateSyscall(int sysno) const { | 54 ResultExpr NaClBPFSandboxPolicy::EvaluateSyscall(int sysno) const { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy)); | 134 scoped_ptr<sandbox::bpf_dsl::Policy>(new NaClBPFSandboxPolicy)); |
| 135 if (sandbox_is_initialized) { | 135 if (sandbox_is_initialized) { |
| 136 RunSandboxSanityChecks(); | 136 RunSandboxSanityChecks(); |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 #endif // defined(USE_SECCOMP_BPF) | 139 #endif // defined(USE_SECCOMP_BPF) |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace nacl | 143 } // namespace nacl |
| OLD | NEW |