Chromium Code Reviews| 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> |
| 11 #include <linux/net.h> | 11 #include <linux/net.h> |
| 12 #include <sched.h> | 12 #include <sched.h> |
| 13 #include <signal.h> | 13 #include <signal.h> |
| 14 #include <sys/ioctl.h> | 14 #include <sys/ioctl.h> |
| 15 #include <sys/mman.h> | 15 #include <sys/mman.h> |
| 16 #include <sys/prctl.h> | 16 #include <sys/prctl.h> |
| 17 #include <sys/resource.h> | |
| 17 #include <sys/stat.h> | 18 #include <sys/stat.h> |
| 19 #include <sys/time.h> | |
| 18 #include <sys/types.h> | 20 #include <sys/types.h> |
| 19 #include <unistd.h> | 21 #include <unistd.h> |
| 20 | 22 |
| 21 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
| 22 #include "base/logging.h" | 24 #include "base/logging.h" |
| 23 #include "base/macros.h" | 25 #include "base/macros.h" |
| 24 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 25 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 27 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
| 26 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" | 28 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" |
| 27 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 29 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 FUTEX_WAKE, | 237 FUTEX_WAKE, |
| 236 FUTEX_REQUEUE, | 238 FUTEX_REQUEUE, |
| 237 FUTEX_CMP_REQUEUE, | 239 FUTEX_CMP_REQUEUE, |
| 238 FUTEX_WAKE_OP, | 240 FUTEX_WAKE_OP, |
| 239 FUTEX_WAIT_BITSET, | 241 FUTEX_WAIT_BITSET, |
| 240 FUTEX_WAKE_BITSET), | 242 FUTEX_WAKE_BITSET), |
| 241 Allow()) | 243 Allow()) |
| 242 .Default(CrashSIGSYSFutex()); | 244 .Default(CrashSIGSYSFutex()); |
| 243 } | 245 } |
| 244 | 246 |
| 247 bpf_dsl::ResultExpr RestrictGetSetpriority(pid_t target_pid) { | |
|
mdempsky
2014/09/11 17:40:24
There's a "using bpf_dsl::ResultExpr" declaration
jln (very slow on Chromium)
2014/09/11 17:46:32
Done.
| |
| 248 const Arg<int> which(0); | |
| 249 const Arg<int> who(1); | |
| 250 return If(which == PRIO_PROCESS, | |
| 251 If(who == 0 || who == target_pid, Allow()).Else(Error(EPERM))) | |
| 252 .Else(CrashSIGSYS()); | |
| 253 } | |
| 254 | |
| 245 } // namespace sandbox. | 255 } // namespace sandbox. |
| OLD | NEW |