OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h" | 5 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "content/common/sandbox_linux/sandbox_linux.h" | 11 #include "content/common/sandbox_linux/sandbox_linux.h" |
12 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" | 12 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" |
13 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" | 13 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" |
14 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" | 14 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" |
15 #include "sandbox/linux/services/linux_syscalls.h" | 15 #include "sandbox/linux/services/linux_syscalls.h" |
16 | 16 |
17 using sandbox::SyscallSets; | 17 using sandbox::SyscallSets; |
18 using sandbox::bpf_dsl::Allow; | 18 using sandbox::bpf_dsl::Allow; |
19 using sandbox::bpf_dsl::Error; | 19 using sandbox::bpf_dsl::Error; |
20 using sandbox::bpf_dsl::ResultExpr; | 20 using sandbox::bpf_dsl::ResultExpr; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 RendererProcessPolicy::RendererProcessPolicy() {} | 24 RendererProcessPolicy::RendererProcessPolicy() {} |
25 RendererProcessPolicy::~RendererProcessPolicy() {} | 25 RendererProcessPolicy::~RendererProcessPolicy() {} |
26 | 26 |
27 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { | 27 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { |
28 switch (sysno) { | 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(); |
29 case __NR_ioctl: | 33 case __NR_ioctl: |
30 return sandbox::RestrictIoctl(); | 34 return sandbox::RestrictIoctl(); |
31 // Allow the system calls below. | 35 // Allow the system calls below. |
32 // The baseline policy allows __NR_clock_gettime. Allow | |
33 // clock_getres() for V8. crbug.com/329053. | |
34 case __NR_clock_getres: | |
35 case __NR_fdatasync: | 36 case __NR_fdatasync: |
36 case __NR_fsync: | 37 case __NR_fsync: |
37 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) | 38 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) |
38 case __NR_getrlimit: | 39 case __NR_getrlimit: |
39 #endif | 40 #endif |
40 #if defined(__i386__) || defined(__arm__) | 41 #if defined(__i386__) || defined(__arm__) |
41 case __NR_ugetrlimit: | 42 case __NR_ugetrlimit: |
42 #endif | 43 #endif |
43 case __NR_mremap: // See crbug.com/149834. | 44 case __NR_mremap: // See crbug.com/149834. |
44 case __NR_pread64: | 45 case __NR_pread64: |
(...skipping 10 matching lines...) Expand all Loading... |
55 return Allow(); | 56 return Allow(); |
56 case __NR_prlimit64: | 57 case __NR_prlimit64: |
57 return Error(EPERM); // See crbug.com/160157. | 58 return Error(EPERM); // See crbug.com/160157. |
58 default: | 59 default: |
59 // Default on the content baseline policy. | 60 // Default on the content baseline policy. |
60 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); | 61 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 } // namespace content | 65 } // namespace content |
OLD | NEW |