OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_utility_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 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 RendererProcessPolicy::RendererProcessPolicy() {} | 21 UtilityProcessPolicy::UtilityProcessPolicy() { |
22 RendererProcessPolicy::~RendererProcessPolicy() {} | 22 } |
| 23 UtilityProcessPolicy::~UtilityProcessPolicy() { |
| 24 } |
23 | 25 |
24 ErrorCode RendererProcessPolicy::EvaluateSyscall(SandboxBPF* sandbox, | 26 ErrorCode UtilityProcessPolicy::EvaluateSyscall(SandboxBPF* sandbox, |
25 int sysno) const { | 27 int sysno) const { |
| 28 // TODO(mdempsky): For now, this is just a copy of the renderer |
| 29 // policy, which happens to work well for utility processes too. It |
| 30 // should be possible to limit further though. In particular, the |
| 31 // entries below annotated with bug references are most likely |
| 32 // unnecessary. |
| 33 |
26 switch (sysno) { | 34 switch (sysno) { |
27 case __NR_ioctl: | 35 case __NR_ioctl: |
28 return sandbox::RestrictIoctl(sandbox); | 36 return sandbox::RestrictIoctl(sandbox); |
29 // Allow the system calls below. | 37 // Allow the system calls below. |
30 // The baseline policy allows __NR_clock_gettime. Allow | 38 // The baseline policy allows __NR_clock_gettime. Allow |
31 // clock_getres() for V8. crbug.com/329053. | 39 // clock_getres() for V8. crbug.com/329053. |
32 case __NR_clock_getres: | 40 case __NR_clock_getres: |
33 case __NR_fdatasync: | 41 case __NR_fdatasync: |
34 case __NR_fsync: | 42 case __NR_fsync: |
35 case __NR_getpriority: | 43 case __NR_getpriority: |
(...skipping 19 matching lines...) Expand all Loading... |
55 return ErrorCode(ErrorCode::ERR_ALLOWED); | 63 return ErrorCode(ErrorCode::ERR_ALLOWED); |
56 case __NR_prlimit64: | 64 case __NR_prlimit64: |
57 return ErrorCode(EPERM); // See crbug.com/160157. | 65 return ErrorCode(EPERM); // See crbug.com/160157. |
58 default: | 66 default: |
59 // Default on the content baseline policy. | 67 // Default on the content baseline policy. |
60 return SandboxBPFBasePolicy::EvaluateSyscall(sandbox, sysno); | 68 return SandboxBPFBasePolicy::EvaluateSyscall(sandbox, sysno); |
61 } | 69 } |
62 } | 70 } |
63 | 71 |
64 } // namespace content | 72 } // namespace content |
OLD | NEW |