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 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
9 #include "base/logging.h"
10 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
11 #include "sandbox/linux/seccomp-bpf-helpers/baseline_policy.h"
13 using sandbox::bpf_dsl::ResultExpr
;
19 // The errno used for denied file system access system calls, such as open(2).
20 static const int kFSDeniedErrno
= EPERM
;
24 SandboxBPFBasePolicy::SandboxBPFBasePolicy()
25 : baseline_policy_(new sandbox::BaselinePolicy(kFSDeniedErrno
)) {}
26 SandboxBPFBasePolicy::~SandboxBPFBasePolicy() {}
28 ResultExpr
SandboxBPFBasePolicy::EvaluateSyscall(int system_call_number
) const {
29 DCHECK(baseline_policy_
);
30 return baseline_policy_
->EvaluateSyscall(system_call_number
);
33 ResultExpr
SandboxBPFBasePolicy::InvalidSyscall() const {
34 DCHECK(baseline_policy_
);
35 return baseline_policy_
->InvalidSyscall();
38 bool SandboxBPFBasePolicy::PreSandboxHook() {
42 int SandboxBPFBasePolicy::GetFSDeniedErrno() {
43 return kFSDeniedErrno
;
46 } // namespace content.