OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/nacl/zygote/nacl_fork_delegate_linux.h" | 5 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 base::LaunchOptions options; | 191 base::LaunchOptions options; |
192 options.fds_to_remap = &fds_to_map; | 192 options.fds_to_remap = &fds_to_map; |
193 options.clone_flags = CLONE_FS | SIGCHLD; | 193 options.clone_flags = CLONE_FS | SIGCHLD; |
194 | 194 |
195 // The NaCl processes spawned may need to exceed the ambient soft limit | 195 // The NaCl processes spawned may need to exceed the ambient soft limit |
196 // on RLIMIT_AS to allocate the untrusted address space and its guard | 196 // on RLIMIT_AS to allocate the untrusted address space and its guard |
197 // regions. The nacl_helper itself cannot just raise its own limit, | 197 // regions. The nacl_helper itself cannot just raise its own limit, |
198 // because the existing limit may prevent the initial exec of | 198 // because the existing limit may prevent the initial exec of |
199 // nacl_helper_bootstrap from succeeding, with its large address space | 199 // nacl_helper_bootstrap from succeeding, with its large address space |
200 // reservation. | 200 // reservation. |
201 std::set<int> max_these_limits; | 201 std::vector<int> max_these_limits; |
202 max_these_limits.insert(RLIMIT_AS); | 202 max_these_limits.push_back(RLIMIT_AS); |
203 options.maximize_rlimits = &max_these_limits; | 203 options.maximize_rlimits = &max_these_limits; |
204 | 204 |
205 if (!base::LaunchProcess(argv_to_launch, options, NULL)) | 205 if (!base::LaunchProcess(argv_to_launch, options, NULL)) |
206 status_ = kNaClHelperLaunchFailed; | 206 status_ = kNaClHelperLaunchFailed; |
207 // parent and error cases are handled below | 207 // parent and error cases are handled below |
208 } | 208 } |
209 if (IGNORE_EINTR(close(fds[1])) != 0) | 209 if (IGNORE_EINTR(close(fds[1])) != 0) |
210 LOG(ERROR) << "close(fds[1]) failed"; | 210 LOG(ERROR) << "close(fds[1]) failed"; |
211 if (status_ == kNaClHelperUnused) { | 211 if (status_ == kNaClHelperUnused) { |
212 const ssize_t kExpectedLength = strlen(kNaClHelperStartupAck); | 212 const ssize_t kExpectedLength = strlen(kNaClHelperStartupAck); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 int remote_exit_code; | 342 int remote_exit_code; |
343 if (!iter.ReadInt(&remote_exit_code)) { | 343 if (!iter.ReadInt(&remote_exit_code)) { |
344 LOG(ERROR) << "GetTerminationStatus: pickle failed"; | 344 LOG(ERROR) << "GetTerminationStatus: pickle failed"; |
345 return false; | 345 return false; |
346 } | 346 } |
347 | 347 |
348 *status = static_cast<base::TerminationStatus>(termination_status); | 348 *status = static_cast<base::TerminationStatus>(termination_status); |
349 *exit_code = remote_exit_code; | 349 *exit_code = remote_exit_code; |
350 return true; | 350 return true; |
351 } | 351 } |
OLD | NEW |