| OLD | NEW |
| 1 // Copyright 2014 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_utility_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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // TODO(mdempsky): For now, this is just a copy of the renderer | 30 // TODO(mdempsky): For now, this is just a copy of the renderer |
| 31 // policy, which happens to work well for utility processes too. It | 31 // policy, which happens to work well for utility processes too. It |
| 32 // should be possible to limit further though. In particular, the | 32 // should be possible to limit further though. In particular, the |
| 33 // entries below annotated with bug references are most likely | 33 // entries below annotated with bug references are most likely |
| 34 // unnecessary. | 34 // unnecessary. |
| 35 | 35 |
| 36 switch (sysno) { | 36 switch (sysno) { |
| 37 case __NR_ioctl: | 37 case __NR_ioctl: |
| 38 return sandbox::RestrictIoctl(); | 38 return sandbox::RestrictIoctl(); |
| 39 // Allow the system calls below. | 39 // Allow the system calls below. |
| 40 // The baseline policy allows __NR_clock_gettime. Allow | |
| 41 // clock_getres() for V8. crbug.com/329053. | |
| 42 case __NR_clock_getres: | |
| 43 case __NR_fdatasync: | 40 case __NR_fdatasync: |
| 44 case __NR_fsync: | 41 case __NR_fsync: |
| 45 case __NR_getpriority: | |
| 46 #if defined(__i386__) || defined(__x86_64__) | 42 #if defined(__i386__) || defined(__x86_64__) |
| 47 case __NR_getrlimit: | 43 case __NR_getrlimit: |
| 48 #endif | 44 #endif |
| 49 #if defined(__i386__) || defined(__arm__) | 45 #if defined(__i386__) || defined(__arm__) |
| 50 case __NR_ugetrlimit: | 46 case __NR_ugetrlimit: |
| 51 #endif | 47 #endif |
| 52 case __NR_mremap: // See crbug.com/149834. | |
| 53 case __NR_pread64: | 48 case __NR_pread64: |
| 54 case __NR_pwrite64: | 49 case __NR_pwrite64: |
| 55 case __NR_sched_getaffinity: | |
| 56 case __NR_sched_get_priority_max: | |
| 57 case __NR_sched_get_priority_min: | |
| 58 case __NR_sched_getparam: | |
| 59 case __NR_sched_getscheduler: | |
| 60 case __NR_sched_setscheduler: | |
| 61 case __NR_setpriority: | |
| 62 case __NR_sysinfo: | 50 case __NR_sysinfo: |
| 63 case __NR_times: | 51 case __NR_times: |
| 64 case __NR_uname: | 52 case __NR_uname: |
| 65 return Allow(); | 53 return Allow(); |
| 66 case __NR_prlimit64: | |
| 67 return Error(EPERM); // See crbug.com/160157. | |
| 68 default: | 54 default: |
| 69 // Default on the content baseline policy. | 55 // Default on the content baseline policy. |
| 70 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); | 56 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); |
| 71 } | 57 } |
| 72 } | 58 } |
| 73 | 59 |
| 74 } // namespace content | 60 } // namespace content |
| OLD | NEW |