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"
9 #include "base/basictypes.h"
10 #include "build/build_config.h"
11 #include "content/common/sandbox_linux/sandbox_linux.h"
12 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
13 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
14 #include "sandbox/linux/services/linux_syscalls.h"
16 using sandbox::SyscallSets
;
17 using sandbox::bpf_dsl::Allow
;
18 using sandbox::bpf_dsl::Error
;
19 using sandbox::bpf_dsl::ResultExpr
;
23 RendererProcessPolicy::RendererProcessPolicy() {}
24 RendererProcessPolicy::~RendererProcessPolicy() {}
26 ResultExpr
RendererProcessPolicy::EvaluateSyscall(int sysno
) const {
28 // The baseline policy allows __NR_clock_gettime. Allow
29 // clock_getres() for V8. crbug.com/329053.
30 case __NR_clock_getres
:
31 return sandbox::RestrictClockID();
33 return sandbox::RestrictIoctl();
34 // Allow the system calls below.
37 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
40 #if defined(__i386__) || defined(__arm__)
43 case __NR_mremap
: // See crbug.com/149834.
46 case __NR_sched_getaffinity
:
47 case __NR_sched_get_priority_max
:
48 case __NR_sched_get_priority_min
:
49 case __NR_sched_getparam
:
50 case __NR_sched_getscheduler
:
51 case __NR_sched_setscheduler
:
57 return Error(EPERM
); // See crbug.com/160157.
59 // Default on the content baseline policy.
60 return SandboxBPFBasePolicy::EvaluateSyscall(sysno
);
64 } // namespace content