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/net.h> | 11 #include <linux/net.h> |
11 #include <sched.h> | 12 #include <sched.h> |
12 #include <signal.h> | 13 #include <signal.h> |
13 #include <sys/ioctl.h> | 14 #include <sys/ioctl.h> |
14 #include <sys/mman.h> | 15 #include <sys/mman.h> |
15 #include <sys/prctl.h> | 16 #include <sys/prctl.h> |
16 #include <sys/stat.h> | 17 #include <sys/stat.h> |
17 #include <sys/types.h> | 18 #include <sys/types.h> |
18 #include <unistd.h> | 19 #include <unistd.h> |
19 | 20 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 ErrorCode(ErrorCode::ERR_ALLOWED), | 240 ErrorCode(ErrorCode::ERR_ALLOWED), |
240 sandbox->Trap(SIGSYSKillFailure, NULL)); | 241 sandbox->Trap(SIGSYSKillFailure, NULL)); |
241 case __NR_tkill: | 242 case __NR_tkill: |
242 return sandbox->Trap(SIGSYSKillFailure, NULL); | 243 return sandbox->Trap(SIGSYSKillFailure, NULL); |
243 default: | 244 default: |
244 NOTREACHED(); | 245 NOTREACHED(); |
245 return sandbox->Trap(CrashSIGSYS_Handler, NULL); | 246 return sandbox->Trap(CrashSIGSYS_Handler, NULL); |
246 } | 247 } |
247 } | 248 } |
248 | 249 |
250 ErrorCode RestrictFutex(SandboxBPF* sandbox) { | |
251 const int banned_futex_bits = | |
mdempsky
2014/06/04 04:55:34
kBannedFutexBits?
Also, I don't think this does w
jln (very slow on Chromium)
2014/06/04 19:30:23
I think it's correct, but you're right that this s
| |
252 ~(FUTEX_CMD_MASK | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); | |
253 | |
254 return sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_HAS_ANY_BITS, | |
255 banned_futex_bits, | |
256 sandbox->Trap(CrashSIGSYS_Handler, NULL), | |
257 sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, | |
mdempsky
2014/06/04 04:55:34
Nit: Indent one more space.
jln (very slow on Chromium)
2014/06/04 19:30:23
Done.
| |
258 FUTEX_CMP_REQUEUE_PI, | |
259 sandbox->Trap(CrashSIGSYS_Handler, NULL), | |
260 sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, | |
261 FUTEX_CMP_REQUEUE_PI_PRIVATE, | |
262 sandbox->Trap(CrashSIGSYS_Handler, NULL), | |
263 sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, | |
264 FUTEX_CMP_REQUEUE_PI | FUTEX_CLOCK_REALTIME, | |
265 sandbox->Trap(CrashSIGSYS_Handler, NULL), | |
266 sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, | |
267 FUTEX_CMP_REQUEUE_PI_PRIVATE | FUTEX_CLOCK_REALTIME, | |
268 sandbox->Trap(CrashSIGSYS_Handler, NULL), | |
269 ErrorCode(ErrorCode::ERR_ALLOWED)))))); | |
270 } | |
271 | |
249 } // namespace sandbox. | 272 } // namespace sandbox. |
OLD | NEW |