| 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/syscall_parameters_restrictions.h" | 5 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <linux/futex.h> | |
| 11 #include <linux/net.h> | 10 #include <linux/net.h> |
| 12 #include <sched.h> | 11 #include <sched.h> |
| 13 #include <signal.h> | 12 #include <signal.h> |
| 14 #include <stdint.h> | 13 #include <stdint.h> |
| 15 #include <sys/ioctl.h> | 14 #include <sys/ioctl.h> |
| 16 #include <sys/mman.h> | 15 #include <sys/mman.h> |
| 17 #include <sys/prctl.h> | 16 #include <sys/prctl.h> |
| 18 #include <sys/resource.h> | 17 #include <sys/resource.h> |
| 19 #include <sys/stat.h> | 18 #include <sys/stat.h> |
| 20 #include <sys/time.h> | 19 #include <sys/time.h> |
| 21 #include <sys/types.h> | 20 #include <sys/types.h> |
| 22 #include <time.h> | 21 #include <time.h> |
| 23 #include <unistd.h> | 22 #include <unistd.h> |
| 24 | 23 |
| 25 #include "base/logging.h" | 24 #include "base/logging.h" |
| 26 #include "base/macros.h" | 25 #include "base/macros.h" |
| 27 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 28 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 29 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | 28 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 30 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" | 29 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" |
| 31 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 30 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
| 32 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 31 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 32 #include "sandbox/linux/system_headers/linux_futex.h" |
| 33 #include "sandbox/linux/system_headers/linux_syscalls.h" | 33 #include "sandbox/linux/system_headers/linux_syscalls.h" |
| 34 | 34 |
| 35 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 36 | 36 |
| 37 #include "sandbox/linux/system_headers/android_futex.h" | |
| 38 | |
| 39 #if !defined(F_DUPFD_CLOEXEC) | 37 #if !defined(F_DUPFD_CLOEXEC) |
| 40 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) | 38 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) |
| 41 #endif | 39 #endif |
| 42 | 40 |
| 43 // https://android.googlesource.com/platform/bionic/+/lollipop-release/libc/priv
ate/bionic_prctl.h | 41 // https://android.googlesource.com/platform/bionic/+/lollipop-release/libc/priv
ate/bionic_prctl.h |
| 44 #if !defined(PR_SET_VMA) | 42 #if !defined(PR_SET_VMA) |
| 45 #define PR_SET_VMA 0x53564d41 | 43 #define PR_SET_VMA 0x53564d41 |
| 46 #endif | 44 #endif |
| 47 | 45 |
| 48 // https://android.googlesource.com/platform/system/core/+/lollipop-release/libc
utils/sched_policy.c | 46 // https://android.googlesource.com/platform/system/core/+/lollipop-release/libc
utils/sched_policy.c |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 const Arg<pid_t> pid(0); | 301 const Arg<pid_t> pid(0); |
| 304 return If(pid == 0 || pid == target_pid, Allow()).Else(CrashSIGSYS()); | 302 return If(pid == 0 || pid == target_pid, Allow()).Else(CrashSIGSYS()); |
| 305 } | 303 } |
| 306 | 304 |
| 307 ResultExpr RestrictGetrusage() { | 305 ResultExpr RestrictGetrusage() { |
| 308 const Arg<int> who(0); | 306 const Arg<int> who(0); |
| 309 return If(who == RUSAGE_SELF, Allow()).Else(CrashSIGSYS()); | 307 return If(who == RUSAGE_SELF, Allow()).Else(CrashSIGSYS()); |
| 310 } | 308 } |
| 311 | 309 |
| 312 } // namespace sandbox. | 310 } // namespace sandbox. |
| OLD | NEW |