Chromium Code Reviews| 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/android/sandbox_bpf_base_policy_android.h " | 5 #include "content/common/sandbox_linux/android/sandbox_bpf_base_policy_android.h " |
| 6 | 6 |
| 7 #include <sys/syscall.h> | 7 #include <sys/syscall.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 ResultExpr SandboxBPFBasePolicyAndroid::EvaluateSyscall(int sysno) const { | 23 ResultExpr SandboxBPFBasePolicyAndroid::EvaluateSyscall(int sysno) const { |
| 24 bool override_and_allow = false; | 24 bool override_and_allow = false; |
| 25 | 25 |
| 26 switch (sysno) { | 26 switch (sysno) { |
| 27 // TODO(rsesek): restrict clone parameters. | 27 // TODO(rsesek): restrict clone parameters. |
| 28 case __NR_clone: | 28 case __NR_clone: |
| 29 case __NR_epoll_pwait: | 29 case __NR_epoll_pwait: |
| 30 case __NR_flock: | 30 case __NR_flock: |
| 31 #if defined(__x86_64__) || defined(__aarch64__) | 31 #if defined(__x86_64__) || defined(__aarch64__) |
| 32 case __NR_newfstatat: | 32 case __NR_newfstatat: |
| 33 case __NR_getdents64: | |
| 33 #elif defined(__i386__) || defined(__arm__) || defined(__mips__) | 34 #elif defined(__i386__) || defined(__arm__) || defined(__mips__) |
| 34 case __NR_fstatat64: | 35 case __NR_fstatat64: |
| 36 case __NR_getdents: | |
| 35 #endif | 37 #endif |
| 36 case __NR_getpriority: | 38 case __NR_getpriority: |
| 37 case __NR_ioctl: | 39 case __NR_ioctl: |
| 38 case __NR_mremap: | 40 case __NR_mremap: |
| 39 // File system access cannot be restricted with seccomp-bpf on Android, | 41 // File system access cannot be restricted with seccomp-bpf on Android, |
| 40 // since the JVM classloader and other Framework features require file | 42 // since the JVM classloader and other Framework features require file |
| 41 // access. It may be possible to restrict the filesystem with SELinux. | 43 // access. It may be possible to restrict the filesystem with SELinux. |
| 42 // Currently we rely on the app/service UID isolation to create a | 44 // Currently we rely on the app/service UID isolation to create a |
| 43 // filesystem "sandbox". | 45 // filesystem "sandbox". |
| 44 #if !defined(ARCH_CPU_ARM64) | 46 #if !defined(ARCH_CPU_ARM64) |
| 45 case __NR_open: | 47 case __NR_open: |
| 46 #endif | 48 #endif |
| 47 case __NR_openat: | 49 case __NR_openat: |
| 48 case __NR_pread64: | 50 case __NR_pread64: |
| 49 case __NR_rt_sigtimedwait: | 51 case __NR_rt_sigtimedwait: |
| 50 case __NR_setpriority: | 52 case __NR_setpriority: |
| 51 case __NR_set_tid_address: | 53 case __NR_set_tid_address: |
| 52 case __NR_sigaltstack: | 54 case __NR_sigaltstack: |
| 53 #if defined(__i386__) || defined(__arm__) | 55 #if defined(__i386__) || defined(__arm__) |
| 54 case __NR_ugetrlimit: | 56 case __NR_ugetrlimit: |
| 55 #else | 57 #else |
| 56 case __NR_getrlimit: | 58 case __NR_getrlimit: |
| 57 #endif | 59 #endif |
| 58 case __NR_uname: | 60 case __NR_uname: |
| 61 | |
| 62 // Permit socket operations so that renderers can connect to logd and | |
| 63 // debuggerd. | |
| 64 case __NR_socket: | |
|
mdempsky
2016/02/05 18:31:46
These seem scary. Is there anything in place to p
Robert Sesek
2016/02/05 19:57:12
Yeah, I wasn't wild about having to add these, but
| |
| 65 case __NR_connect: | |
| 66 | |
| 67 // Ptrace is allowed so the Breakpad Microdumper can fork in a renderer | |
| 68 // and then ptrace the parent. | |
| 69 case __NR_ptrace: | |
| 59 override_and_allow = true; | 70 override_and_allow = true; |
| 60 break; | 71 break; |
| 61 } | 72 } |
| 62 | 73 |
| 63 if (override_and_allow) | 74 if (override_and_allow) |
| 64 return Allow(); | 75 return Allow(); |
| 65 | 76 |
| 66 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); | 77 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); |
| 67 } | 78 } |
| 68 | 79 |
| 69 } // namespace content | 80 } // namespace content |
| OLD | NEW |