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
3 // found in the LICENSE file.
5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_POLICY_H_
6 #define SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_POLICY_H_
8 #include "base/basictypes.h"
9 #include "sandbox/sandbox_export.h"
16 // This is the interface to implement to define a BPF sandbox policy.
17 class SANDBOX_EXPORT SandboxBPFPolicy
{
20 virtual ~SandboxBPFPolicy() {}
22 // The EvaluateSyscall method is called with the system call number. It can
23 // decide to allow the system call unconditionally by returning ERR_ALLOWED;
24 // it can deny the system call unconditionally by returning an appropriate
25 // "errno" value; or it can request inspection of system call argument(s) by
26 // returning a suitable ErrorCode.
27 // Will only be called for valid system call numbers.
28 virtual ErrorCode
EvaluateSyscall(SandboxBPF
* sandbox_compiler
,
29 int system_call_number
) const = 0;
31 // The InvalidSyscall method specifies the behavior used for invalid
32 // system calls. The default implementation is to return ENOSYS.
33 virtual ErrorCode
InvalidSyscall(SandboxBPF
* sandbox_compiler
) const;
36 DISALLOW_COPY_AND_ASSIGN(SandboxBPFPolicy
);
39 } // namespace sandbox
41 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_POLICY_H_