Add ICU message format support
[chromium-blink-merge.git] / content / common / sandbox_linux / bpf_renderer_policy_linux.cc
blobbd252ff755718d5cb28e29252416b5b2c927f835
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_renderer_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 RendererProcessPolicy::RendererProcessPolicy() {}
25 RendererProcessPolicy::~RendererProcessPolicy() {}
27 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
28 switch (sysno) {
29 // The baseline policy allows __NR_clock_gettime. Allow
30 // clock_getres() for V8. crbug.com/329053.
31 case __NR_clock_getres:
32 return sandbox::RestrictClockID();
33 case __NR_ioctl:
34 return sandbox::RestrictIoctl();
35 // Allow the system calls below.
36 case __NR_fdatasync:
37 case __NR_fsync:
38 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
39 case __NR_getrlimit:
40 #endif
41 #if defined(__i386__) || defined(__arm__)
42 case __NR_ugetrlimit:
43 #endif
44 case __NR_mremap: // See crbug.com/149834.
45 case __NR_pread64:
46 case __NR_pwrite64:
47 case __NR_sched_get_priority_max:
48 case __NR_sched_get_priority_min:
49 case __NR_sysinfo:
50 case __NR_times:
51 case __NR_uname:
52 return Allow();
53 case __NR_sched_getaffinity:
54 case __NR_sched_getparam:
55 case __NR_sched_getscheduler:
56 case __NR_sched_setscheduler:
57 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
58 case __NR_prlimit64:
59 return Error(EPERM); // See crbug.com/160157.
60 default:
61 // Default on the content baseline policy.
62 return SandboxBPFBasePolicy::EvaluateSyscall(sysno);
66 } // namespace content