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

Side by Side Diff: sandbox/linux/seccomp-bpf/sandbox_bpf_compatibility_policy.h

Issue 293463002: Add SandboxBPFPolicy::InvalidSyscall() to simplify writing policies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_
6 #define SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_ 6 #define SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 10 matching lines...) Expand all
21 typedef ErrorCode (*SyscallEvaluator)(SandboxBPF* sandbox_compiler, 21 typedef ErrorCode (*SyscallEvaluator)(SandboxBPF* sandbox_compiler,
22 int system_call_number, 22 int system_call_number,
23 AuxType* aux); 23 AuxType* aux);
24 CompatibilityPolicy(SyscallEvaluator syscall_evaluator, AuxType* aux) 24 CompatibilityPolicy(SyscallEvaluator syscall_evaluator, AuxType* aux)
25 : syscall_evaluator_(syscall_evaluator), aux_(aux) {} 25 : syscall_evaluator_(syscall_evaluator), aux_(aux) {}
26 26
27 virtual ~CompatibilityPolicy() {} 27 virtual ~CompatibilityPolicy() {}
28 28
29 virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler, 29 virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler,
30 int system_call_number) const OVERRIDE { 30 int system_call_number) const OVERRIDE {
31 DCHECK(SandboxBPF::IsValidSyscallNumber(system_call_number));
31 return syscall_evaluator_(sandbox_compiler, system_call_number, aux_); 32 return syscall_evaluator_(sandbox_compiler, system_call_number, aux_);
32 } 33 }
33 34
34 private: 35 private:
35 SyscallEvaluator syscall_evaluator_; 36 SyscallEvaluator syscall_evaluator_;
36 AuxType* aux_; 37 AuxType* aux_;
37 DISALLOW_COPY_AND_ASSIGN(CompatibilityPolicy); 38 DISALLOW_COPY_AND_ASSIGN(CompatibilityPolicy);
38 }; 39 };
39 40
40 } // namespace sandbox 41 } // namespace sandbox
41 42
42 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_ 43 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_COMPATIBILITY_POLICY_H_
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698