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> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 } | 242 } |
| 243 | 243 |
| 244 ResultExpr RestrictGetSetpriority(pid_t target_pid) { | 244 ResultExpr RestrictGetSetpriority(pid_t target_pid) { |
| 245 const Arg<int> which(0); | 245 const Arg<int> which(0); |
| 246 const Arg<int> who(1); | 246 const Arg<int> who(1); |
| 247 return If(which == PRIO_PROCESS, | 247 return If(which == PRIO_PROCESS, |
| 248 If(who == 0 || who == target_pid, Allow()).Else(Error(EPERM))) | 248 If(who == 0 || who == target_pid, Allow()).Else(Error(EPERM))) |
| 249 .Else(CrashSIGSYS()); | 249 .Else(CrashSIGSYS()); |
| 250 } | 250 } |
| 251 | 251 |
| 252 ResultExpr RestrictIoPrioGetSet(pid_t target_pid) { | |
| 253 const Arg<int> which(0); | |
| 254 const Arg<int> who(1); | |
| 255 return If(which == PRIO_PROCESS, | |
| 256 If(who == 0 || who == target_pid, Allow()).Else(Error(EPERM))) | |
|
jln (very slow on Chromium)
2014/10/09 00:31:24
No case spotted of who == gettid() ?
That's good
| |
| 257 .Else(CrashSIGSYS()); | |
| 258 } | |
| 259 | |
| 252 ResultExpr RestrictClockID() { | 260 ResultExpr RestrictClockID() { |
| 253 COMPILE_ASSERT(4 == sizeof(clockid_t), clockid_is_not_32bit); | 261 COMPILE_ASSERT(4 == sizeof(clockid_t), clockid_is_not_32bit); |
| 254 const Arg<clockid_t> clockid(0); | 262 const Arg<clockid_t> clockid(0); |
| 255 return If( | 263 return If( |
| 256 #if defined(OS_CHROMEOS) | 264 #if defined(OS_CHROMEOS) |
| 257 // Allow the special clock for Chrome OS used by Chrome tracing. | 265 // Allow the special clock for Chrome OS used by Chrome tracing. |
| 258 clockid == base::TimeTicks::kClockSystemTrace || | 266 clockid == base::TimeTicks::kClockSystemTrace || |
| 259 #endif | 267 #endif |
| 260 clockid == CLOCK_MONOTONIC || | 268 clockid == CLOCK_MONOTONIC || |
| 261 clockid == CLOCK_PROCESS_CPUTIME_ID || | 269 clockid == CLOCK_PROCESS_CPUTIME_ID || |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 280 .Else(RewriteSchedSIGSYS()); | 288 .Else(RewriteSchedSIGSYS()); |
| 281 } | 289 } |
| 282 default: | 290 default: |
| 283 NOTREACHED(); | 291 NOTREACHED(); |
| 284 return CrashSIGSYS(); | 292 return CrashSIGSYS(); |
| 285 } | 293 } |
| 286 } | 294 } |
| 287 | 295 |
| 288 | 296 |
| 289 } // namespace sandbox. | 297 } // namespace sandbox. |
| OLD | NEW |