OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "sandbox/linux/seccomp-bpf-helpers/baseline_policy.h" | 5 #include "sandbox/linux/seccomp-bpf-helpers/baseline_policy.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // non-ASan builds. | 113 // non-ASan builds. |
114 return Allow(); | 114 return Allow(); |
115 } | 115 } |
116 #endif // defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || | 116 #endif // defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || |
117 // defined(MEMORY_SANITIZER) | 117 // defined(MEMORY_SANITIZER) |
118 | 118 |
119 if (IsBaselinePolicyAllowed(sysno)) { | 119 if (IsBaselinePolicyAllowed(sysno)) { |
120 return Allow(); | 120 return Allow(); |
121 } | 121 } |
122 | 122 |
123 #if defined(__aarch64__) | 123 #if defined(OS_ANDROID) |
124 // These are needed for thread creation. | 124 // Needed for thread creation. |
125 // TODO(leecam): Check jln's fix for this and remove these 'allows'. | 125 if (sysno == __NR_sigaltstack) |
126 if (sysno == __NR_sigaltstack || sysno == __NR_setpriority) | |
127 return Allow(); | 126 return Allow(); |
128 #endif | 127 #endif |
129 | 128 |
130 if (sysno == __NR_clone) { | 129 if (sysno == __NR_clone) { |
131 return RestrictCloneToThreadsAndEPERMFork(); | 130 return RestrictCloneToThreadsAndEPERMFork(); |
132 } | 131 } |
133 | 132 |
134 if (sysno == __NR_fcntl) | 133 if (sysno == __NR_fcntl) |
135 return RestrictFcntlCommands(); | 134 return RestrictFcntlCommands(); |
136 | 135 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 DCHECK_EQ(syscall(__NR_getpid), current_pid_); | 247 DCHECK_EQ(syscall(__NR_getpid), current_pid_); |
249 } | 248 } |
250 return EvaluateSyscallImpl(fs_denied_errno_, current_pid_, sysno); | 249 return EvaluateSyscallImpl(fs_denied_errno_, current_pid_, sysno); |
251 } | 250 } |
252 | 251 |
253 ResultExpr BaselinePolicy::InvalidSyscall() const { | 252 ResultExpr BaselinePolicy::InvalidSyscall() const { |
254 return CrashSIGSYS(); | 253 return CrashSIGSYS(); |
255 } | 254 } |
256 | 255 |
257 } // namespace sandbox. | 256 } // namespace sandbox. |
OLD | NEW |