| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return CrashSIGSYSKill(); | 222 return CrashSIGSYSKill(); |
| 223 default: | 223 default: |
| 224 NOTREACHED(); | 224 NOTREACHED(); |
| 225 return CrashSIGSYS(); | 225 return CrashSIGSYS(); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 ResultExpr RestrictFutex() { | 229 ResultExpr RestrictFutex() { |
| 230 const int kAllowedFutexFlags = FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME; | 230 const int kAllowedFutexFlags = FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME; |
| 231 const int kOperationMask = ~kAllowedFutexFlags; | 231 const int kOperationMask = ~kAllowedFutexFlags; |
| 232 | |
| 233 const Arg<int> op(1); | 232 const Arg<int> op(1); |
| 234 return Switch(op & kOperationMask) | 233 return Switch(op & kOperationMask) |
| 235 .CASES((FUTEX_WAIT, | 234 .CASES((FUTEX_WAIT, |
| 236 FUTEX_WAKE, | 235 FUTEX_WAKE, |
| 237 FUTEX_FD, | |
| 238 FUTEX_REQUEUE, | 236 FUTEX_REQUEUE, |
| 239 FUTEX_CMP_REQUEUE, | 237 FUTEX_CMP_REQUEUE, |
| 240 FUTEX_WAKE_OP, | 238 FUTEX_WAKE_OP, |
| 241 FUTEX_WAIT_BITSET, | 239 FUTEX_WAIT_BITSET, |
| 242 FUTEX_WAKE_BITSET), | 240 FUTEX_WAKE_BITSET), |
| 243 Allow()) | 241 Allow()) |
| 244 .Default(CrashSIGSYSFutex()); | 242 .Default(CrashSIGSYSFutex()); |
| 245 } | 243 } |
| 246 | 244 |
| 247 } // namespace sandbox. | 245 } // namespace sandbox. |
| OLD | NEW |