Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: sandbox/linux/services/syscall_wrappers.cc

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/linux/seccomp-bpf/trap.h ('k') | sandbox/linux/syscall_broker/broker_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // Should not be reached. 56 // Should not be reached.
57 RAW_CHECK(false); 57 RAW_CHECK(false);
58 return 1; 58 return 1;
59 } 59 }
60 60
61 // This function is noinline to ensure that stack_buf is below the stack pointer 61 // This function is noinline to ensure that stack_buf is below the stack pointer
62 // that is saved when setjmp is called below. This is needed because when 62 // that is saved when setjmp is called below. This is needed because when
63 // compiled with FORTIFY_SOURCE, glibc's longjmp checks that the stack is moved 63 // compiled with FORTIFY_SOURCE, glibc's longjmp checks that the stack is moved
64 // upwards. See crbug.com/442912 for more details. 64 // upwards. See crbug.com/442912 for more details.
65 #if defined(ADDRESS_SANITIZER)
66 // Disable AddressSanitizer instrumentation for this function to make sure
67 // |stack_buf| is allocated on thread stack instead of ASan's fake stack.
68 // Under ASan longjmp() will attempt to clean up the area between the old and
69 // new stack pointers and print a warning that may confuse the user.
70 __attribute__((no_sanitize_address))
71 #endif
65 NOINLINE pid_t CloneAndLongjmpInChild(unsigned long flags, 72 NOINLINE pid_t CloneAndLongjmpInChild(unsigned long flags,
66 pid_t* ptid, 73 pid_t* ptid,
67 pid_t* ctid, 74 pid_t* ctid,
68 jmp_buf* env) { 75 jmp_buf* env) {
69 // We use the libc clone wrapper instead of making the syscall 76 // We use the libc clone wrapper instead of making the syscall
70 // directly because making the syscall may fail to update the libc's 77 // directly because making the syscall may fail to update the libc's
71 // internal pid cache. The libc interface unfortunately requires 78 // internal pid cache. The libc interface unfortunately requires
72 // specifying a new stack, so we use setjmp/longjmp to emulate 79 // specifying a new stack, so we use setjmp/longjmp to emulate
73 // fork-like behavior. 80 // fork-like behavior.
74 char stack_buf[PTHREAD_STACK_MIN]; 81 char stack_buf[PTHREAD_STACK_MIN];
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 148 }
142 149
143 int sys_prlimit64(pid_t pid, 150 int sys_prlimit64(pid_t pid,
144 int resource, 151 int resource,
145 const struct rlimit64* new_limit, 152 const struct rlimit64* new_limit,
146 struct rlimit64* old_limit) { 153 struct rlimit64* old_limit) {
147 return syscall(__NR_prlimit64, pid, resource, new_limit, old_limit); 154 return syscall(__NR_prlimit64, pid, resource, new_limit, old_limit);
148 } 155 }
149 156
150 } // namespace sandbox 157 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/trap.h ('k') | sandbox/linux/syscall_broker/broker_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698