| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_ | |
| 6 #define SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_ | |
| 7 | |
| 8 #include "base/logging.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | |
| 11 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" | |
| 12 | |
| 13 namespace sandbox { | |
| 14 | |
| 15 // This class allows compatibility with the old, deprecated | |
| 16 // policies that were designed for SetSandboxPolicyDeprecated(). | |
| 17 template <class AuxType> | |
| 18 class CompatibilityPolicy : public SandboxBPFPolicy { | |
| 19 public: | |
| 20 typedef ErrorCode (*SyscallEvaluator)(SandboxBPF* sandbox_compiler, | |
| 21 int system_call_number, | |
| 22 AuxType* aux); | |
| 23 CompatibilityPolicy(SyscallEvaluator syscall_evaluator, AuxType* aux) | |
| 24 : syscall_evaluator_(syscall_evaluator), aux_(aux) {} | |
| 25 | |
| 26 virtual ~CompatibilityPolicy() {} | |
| 27 | |
| 28 virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler, | |
| 29 int system_call_number) const OVERRIDE { | |
| 30 DCHECK(SandboxBPF::IsValidSyscallNumber(system_call_number)); | |
| 31 return syscall_evaluator_(sandbox_compiler, system_call_number, aux_); | |
| 32 } | |
| 33 | |
| 34 private: | |
| 35 SyscallEvaluator syscall_evaluator_; | |
| 36 AuxType* aux_; | |
| 37 DISALLOW_COPY_AND_ASSIGN(CompatibilityPolicy); | |
| 38 }; | |
| 39 | |
| 40 } // namespace sandbox | |
| 41 | |
| 42 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_ | |
| OLD | NEW |