Add ICU message format support
[chromium-blink-merge.git] / content / common / sandbox_linux / bpf_ppapi_policy_linux.cc
blob8a7cee54d69ed48c9b8aa8a8cc48f78d2d01aa56
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/bpf_ppapi_policy_linux.h"
7 #include <errno.h>
9 #include "base/basictypes.h"
10 #include "build/build_config.h"
11 #include "content/common/sandbox_linux/sandbox_linux.h"
12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
13 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
14 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
15 #include "sandbox/linux/system_headers/linux_syscalls.h"
17 using sandbox::SyscallSets;
18 using sandbox::bpf_dsl::Allow;
19 using sandbox::bpf_dsl::Error;
20 using sandbox::bpf_dsl::ResultExpr;
22 namespace content {
24 PpapiProcessPolicy::PpapiProcessPolicy() {}
25 PpapiProcessPolicy::~PpapiProcessPolicy() {}
27 ResultExpr PpapiProcessPolicy::EvaluateSyscall(int sysno) const {
28 switch (sysno) {
29 // TODO(jln): restrict prctl.
30 case __NR_prctl:
31 case __NR_pread64:
32 case __NR_pwrite64:
33 case __NR_sched_get_priority_max:
34 case __NR_sched_get_priority_min:
35 case __NR_times:
36 return Allow();
37 case __NR_sched_getaffinity:
38 case __NR_sched_getparam:
39 case __NR_sched_getscheduler:
40 case __NR_sched_setscheduler:
41 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
42 case __NR_ioctl:
43 return Error(ENOTTY); // Flash Access.
44 default:
45 // Default on the baseline policy.
46 return SandboxBPFBasePolicy::EvaluateSyscall(sysno);
50 } // namespace content