| 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> | 10 #include <linux/futex.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include <unistd.h> | 22 #include <unistd.h> |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/macros.h" | 26 #include "base/macros.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 29 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 29 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
| 30 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" | 30 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" |
| 31 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 31 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 32 #include "sandbox/linux/services/linux_syscalls.h" |
| 32 | 33 |
| 33 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 34 | 35 |
| 35 #include "sandbox/linux/services/android_futex.h" | 36 #include "sandbox/linux/services/android_futex.h" |
| 36 | 37 |
| 37 #if !defined(F_DUPFD_CLOEXEC) | 38 #if !defined(F_DUPFD_CLOEXEC) |
| 38 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) | 39 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 #endif // defined(OS_ANDROID) | 42 #endif // defined(OS_ANDROID) |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // Allow the special clock for Chrome OS used by Chrome tracing. | 258 // Allow the special clock for Chrome OS used by Chrome tracing. |
| 258 clockid == base::TimeTicks::kClockSystemTrace || | 259 clockid == base::TimeTicks::kClockSystemTrace || |
| 259 #endif | 260 #endif |
| 260 clockid == CLOCK_MONOTONIC || | 261 clockid == CLOCK_MONOTONIC || |
| 261 clockid == CLOCK_PROCESS_CPUTIME_ID || | 262 clockid == CLOCK_PROCESS_CPUTIME_ID || |
| 262 clockid == CLOCK_REALTIME || | 263 clockid == CLOCK_REALTIME || |
| 263 clockid == CLOCK_THREAD_CPUTIME_ID, | 264 clockid == CLOCK_THREAD_CPUTIME_ID, |
| 264 Allow()).Else(CrashSIGSYS()); | 265 Allow()).Else(CrashSIGSYS()); |
| 265 } | 266 } |
| 266 | 267 |
| 268 ResultExpr RestrictSchedTarget(pid_t target_pid, int sysno) { |
| 269 switch (sysno) { |
| 270 case __NR_sched_getaffinity: |
| 271 case __NR_sched_getattr: |
| 272 case __NR_sched_getparam: |
| 273 case __NR_sched_getscheduler: |
| 274 case __NR_sched_rr_get_interval: |
| 275 case __NR_sched_setaffinity: |
| 276 case __NR_sched_setattr: |
| 277 case __NR_sched_setparam: |
| 278 case __NR_sched_setscheduler: { |
| 279 const Arg<pid_t> pid(0); |
| 280 return If(pid == 0 || pid == target_pid, Allow()) |
| 281 .Else(RewriteSchedSIGSYS()); |
| 282 } |
| 283 default: |
| 284 NOTREACHED(); |
| 285 return CrashSIGSYS(); |
| 286 } |
| 287 } |
| 288 |
| 289 |
| 267 } // namespace sandbox. | 290 } // namespace sandbox. |
| OLD | NEW |