OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/services/syscall_wrappers.h" | 5 #include "sandbox/linux/services/syscall_wrappers.h" |
6 | 6 |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <sched.h> | 8 #include <sched.h> |
9 #include <setjmp.h> | 9 #include <setjmp.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 RAW_LOG(FATAL, "Invalid usage of sys_clone"); | 48 RAW_LOG(FATAL, "Invalid usage of sys_clone"); |
49 } | 49 } |
50 | 50 |
51 if (ptid) MSAN_UNPOISON(ptid, sizeof(*ptid)); | 51 if (ptid) MSAN_UNPOISON(ptid, sizeof(*ptid)); |
52 if (ctid) MSAN_UNPOISON(ctid, sizeof(*ctid)); | 52 if (ctid) MSAN_UNPOISON(ctid, sizeof(*ctid)); |
53 // See kernel/fork.c in Linux. There is different ordering of sys_clone | 53 // See kernel/fork.c in Linux. There is different ordering of sys_clone |
54 // parameters depending on CONFIG_CLONE_BACKWARDS* configuration options. | 54 // parameters depending on CONFIG_CLONE_BACKWARDS* configuration options. |
55 #if defined(ARCH_CPU_X86_64) | 55 #if defined(ARCH_CPU_X86_64) |
56 return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls); | 56 return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls); |
57 #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \ | 57 #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \ |
58 defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_MIPS64_FAMILY) | 58 defined(ARCH_CPU_MIPS_FAMILY) |
59 // CONFIG_CLONE_BACKWARDS defined. | 59 // CONFIG_CLONE_BACKWARDS defined. |
60 return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid); | 60 return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid); |
61 #endif | 61 #endif |
62 } | 62 } |
63 | 63 |
64 long sys_clone(unsigned long flags) { | 64 long sys_clone(unsigned long flags) { |
65 return sys_clone(flags, nullptr, nullptr, nullptr, nullptr); | 65 return sys_clone(flags, nullptr, nullptr, nullptr, nullptr); |
66 } | 66 } |
67 | 67 |
68 void sys_exit_group(int status) { | 68 void sys_exit_group(int status) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 std::memcpy(&oldact->sa_mask, &linux_oldact.sa_mask, | 252 std::memcpy(&oldact->sa_mask, &linux_oldact.sa_mask, |
253 std::min(sizeof(linux_act.sa_mask), sizeof(act->sa_mask))); | 253 std::min(sizeof(linux_act.sa_mask), sizeof(act->sa_mask))); |
254 oldact->sa_flags = linux_oldact.sa_flags; | 254 oldact->sa_flags = linux_oldact.sa_flags; |
255 } | 255 } |
256 return result; | 256 return result; |
257 } | 257 } |
258 | 258 |
259 #endif // defined(MEMORY_SANITIZER) | 259 #endif // defined(MEMORY_SANITIZER) |
260 | 260 |
261 } // namespace sandbox | 261 } // namespace sandbox |
OLD | NEW |