| 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> |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 #include <unistd.h> | 12 #include <unistd.h> |
| 13 | 13 |
| 14 #include "base/debug/debugging_flags.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | 17 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 17 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 18 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
| 18 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" | 19 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" |
| 19 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" | 20 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" |
| 20 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 21 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 21 #include "sandbox/linux/services/syscall_wrappers.h" | 22 #include "sandbox/linux/services/syscall_wrappers.h" |
| 22 #include "sandbox/linux/system_headers/linux_syscalls.h" | 23 #include "sandbox/linux/system_headers/linux_syscalls.h" |
| 23 | 24 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 120 } |
| 120 | 121 |
| 121 if (sysno == __NR_sigaltstack) { | 122 if (sysno == __NR_sigaltstack) { |
| 122 // Required for better stack overflow detection in ASan. Disallowed in | 123 // Required for better stack overflow detection in ASan. Disallowed in |
| 123 // non-ASan builds. | 124 // non-ASan builds. |
| 124 return Allow(); | 125 return Allow(); |
| 125 } | 126 } |
| 126 #endif // defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || | 127 #endif // defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || |
| 127 // defined(MEMORY_SANITIZER) | 128 // defined(MEMORY_SANITIZER) |
| 128 | 129 |
| 130 #if BUILDFLAG(ENABLE_PROFILING) && defined(__GLIBC__) |
| 131 // Native heap profiler uses pthread_getattr_np() which calls |
| 132 // sched_getaffinity. |
| 133 if (sysno == __NR_sched_getaffinity) { |
| 134 return Allow(); |
| 135 } |
| 136 #endif |
| 137 |
| 129 if (IsBaselinePolicyAllowed(sysno)) { | 138 if (IsBaselinePolicyAllowed(sysno)) { |
| 130 return Allow(); | 139 return Allow(); |
| 131 } | 140 } |
| 132 | 141 |
| 133 #if defined(OS_ANDROID) | 142 #if defined(OS_ANDROID) |
| 134 // Needed for thread creation. | 143 // Needed for thread creation. |
| 135 if (sysno == __NR_sigaltstack) | 144 if (sysno == __NR_sigaltstack) |
| 136 return Allow(); | 145 return Allow(); |
| 137 #endif | 146 #endif |
| 138 | 147 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 DCHECK_EQ(sys_getpid(), policy_pid_); | 284 DCHECK_EQ(sys_getpid(), policy_pid_); |
| 276 } | 285 } |
| 277 return EvaluateSyscallImpl(fs_denied_errno_, policy_pid_, sysno); | 286 return EvaluateSyscallImpl(fs_denied_errno_, policy_pid_, sysno); |
| 278 } | 287 } |
| 279 | 288 |
| 280 ResultExpr BaselinePolicy::InvalidSyscall() const { | 289 ResultExpr BaselinePolicy::InvalidSyscall() const { |
| 281 return CrashSIGSYS(); | 290 return CrashSIGSYS(); |
| 282 } | 291 } |
| 283 | 292 |
| 284 } // namespace sandbox. | 293 } // namespace sandbox. |
| OLD | NEW |