launch_posix.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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 3// found in the LICENSE file. 4 5#include "base/process/launch.h" 6 7#include <dirent.h> 8#include <errno.h> 9#include <fcntl.h> 10#include <signal.h> 11#include <stdlib.h> 12#include <sys/resource.h> 13#include <sys/time.h> 14#include <sys/types.h> 15#include <sys/wait.h> 16#include <unistd.h> 17 18#include <iterator> 19#include <limits> 20#include <set> 21 22#include "base/allocator/type_profiler_control.h" 23#include "base/command_line.h" 24#include "base/compiler_specific.h" 25#include "base/debug/debugger.h" 26#include "base/debug/stack_trace.h" 27#include "base/file_util.h" 28#include "base/files/dir_reader_posix.h" 29#include "base/logging.h" 30#include "base/memory/scoped_ptr.h" 31#include "base/posix/eintr_wrapper.h" 32#include "base/process/kill.h" 33#include "base/process/process_metrics.h" 34#include "base/strings/stringprintf.h" 35#include "base/synchronization/waitable_event.h" 36#include "base/third_party/dynamic_annotations/dynamic_annotations.h" 37#include "base/threading/platform_thread.h" 38#include "base/threading/thread_restrictions.h" 39 40#if defined(OS_CHROMEOS) 41#include <sys/ioctl.h> 42#endif 43 44#if defined(OS_FREEBSD) 45#include <sys/event.h> 46#include <sys/ucontext.h> 47#endif 48 49#if defined(OS_MACOSX) 50#include <crt_externs.h> 51#include <sys/event.h> 52#else 53extern char** environ; 54#endif 55 56namespace base { 57 58namespace { 59 60// Get the process's "environment" (i.e. the thing that setenv/getenv 61// work with). 62char** GetEnvironment() { 63#if defined(OS_MACOSX) 64 return *_NSGetEnviron(); 65#else 66 return environ; 67#endif 68} 69 70// Set the process's "environment" (i.e. the thing that setenv/getenv 71// work with). 72void SetEnvironment(char** env) { 73#if defined(OS_MACOSX) 74 *_NSGetEnviron() = env; 75#else 76 environ = env; 77#endif 78} 79 80// Set the calling thread's signal mask to new_sigmask and return 81// the previous signal mask. 82sigset_t SetSignalMask(const sigset_t& new_sigmask) { 83 sigset_t old_sigmask; 84#if defined(OS_ANDROID) 85 // POSIX says pthread_sigmask() must be used in multi-threaded processes, 86 // but Android's pthread_sigmask() was broken until 4.1: 87 // https://code.google.com/p/android/issues/detail?id=15337 88 // http://stackoverflow.com/questions/13777109/pthread-sigmask-on-android-not-working 89 RAW_CHECK(sigprocmask(SIG_SETMASK, &new_sigmask, &old_sigmask) == 0); 90#else 91 RAW_CHECK(pthread_sigmask(SIG_SETMASK, &new_sigmask, &old_sigmask) == 0); 92#endif 93 return old_sigmask; 94} 95 96#if !defined(OS_LINUX) || \ 97 (!defined(__i386__) && !defined(__x86_64__) && !defined(__arm__)) 98void ResetChildSignalHandlersToDefaults() { 99 // The previous signal handlers are likely to be meaningless in the child's 100 // context so we reset them to the defaults for now. http://crbug.com/44953 101 // These signal handlers are set up at least in browser_main_posix.cc: 102 // BrowserMainPartsPosix::PreEarlyInitialization and stack_trace_posix.cc: 103 // EnableInProcessStackDumping. 104 signal(SIGHUP, SIG_DFL); 105 signal(SIGINT, SIG_DFL); 106 signal(SIGILL, SIG_DFL); 107 signal(SIGABRT, SIG_DFL); 108 signal(SIGFPE, SIG_DFL); 109 signal(SIGBUS, SIG_DFL); 110 signal(SIGSEGV, SIG_DFL); 111 signal(SIGSYS, SIG_DFL); 112 signal(SIGTERM, SIG_DFL); 113} 114 115#else 116 117// TODO(jln): remove the Linux special case once kernels are fixed. 118 119// Internally the kernel makes sigset_t an array of long large enough to have 120// one bit per signal. 121typedef uint64_t kernel_sigset_t; 122 123// This is what struct sigaction looks like to the kernel at least on X86 and 124// ARM. MIPS, for instance, is very different. 125struct kernel_sigaction { 126 void* k_sa_handler; // For this usage it only needs to be a generic pointer. 127 unsigned long k_sa_flags; 128 void* k_sa_restorer; // For this usage it only needs to be a generic pointer. 129 kernel_sigset_t k_sa_mask; 130}; 131 132// glibc's sigaction() will prevent access to sa_restorer, so we need to roll 133// our own. 134int sys_rt_sigaction(int sig, const struct kernel_sigaction* act, 135 struct kernel_sigaction* oact) { 136 return syscall(SYS_rt_sigaction, sig, act, oact, sizeof(kernel_sigset_t)); 137} 138 139// This function is intended to be used in between fork() and execve() and will 140// reset all signal handlers to the default. 141// The motivation for going through all of them is that sa_restorer can leak 142// from parents and help defeat ASLR on buggy kernels. We reset it to NULL. 143// See crbug.com/177956. 144void ResetChildSignalHandlersToDefaults(void) { 145 for (int signum = 1; ; ++signum) { 146 struct kernel_sigaction act = {0}; 147 int sigaction_get_ret = sys_rt_sigaction(signum, NULL, &act); 148 if (sigaction_get_ret && errno == EINVAL) { 149#if !defined(NDEBUG) 150 // Linux supports 32 real-time signals from 33 to 64. 151 // If the number of signals in the Linux kernel changes, someone should 152 // look at this code. 153 const int kNumberOfSignals = 64; 154 RAW_CHECK(signum == kNumberOfSignals + 1); 155#endif // !defined(NDEBUG) 156 break; 157 } 158 // All other failures are fatal. 159 if (sigaction_get_ret) { 160 RAW_LOG(FATAL, "sigaction (get) failed."); 161 } 162 163 // The kernel won't allow to re-set SIGKILL or SIGSTOP. 164 if (signum != SIGSTOP && signum != SIGKILL) { 165 act.k_sa_handler = reinterpret_cast<void*>(SIG_DFL); 166 act.k_sa_restorer = NULL; 167 if (sys_rt_sigaction(signum, &act, NULL)) { 168 RAW_LOG(FATAL, "sigaction (set) failed."); 169 } 170 } 171#if !defined(NDEBUG) 172 // Now ask the kernel again and check that no restorer will leak. 173 if (sys_rt_sigaction(signum, NULL, &act) || act.k_sa_restorer) { 174 RAW_LOG(FATAL, "Cound not fix sa_restorer."); 175 } 176#endif // !defined(NDEBUG) 177 } 178} 179#endif // !defined(OS_LINUX) || 180 // (!defined(__i386__) && !defined(__x86_64__) && !defined(__arm__)) 181 182} // anonymous namespace 183 184// Functor for |ScopedDIR| (below). 185struct ScopedDIRClose { 186 inline void operator()(DIR* x) const { 187 if (x) 188 closedir(x); 189 } 190}; 191 192// Automatically closes |DIR*|s. 193typedef scoped_ptr<DIR, ScopedDIRClose> ScopedDIR; 194 195#if defined(OS_LINUX) 196static const char kFDDir[] = "/proc/self/fd"; 197#elif defined(OS_MACOSX) 198static const char kFDDir[] = "/dev/fd"; 199#elif defined(OS_SOLARIS) 200static const char kFDDir[] = "/dev/fd"; 201#elif defined(OS_FREEBSD) 202static const char kFDDir[] = "/dev/fd"; 203#elif defined(OS_OPENBSD) 204static const char kFDDir[] = "/dev/fd"; 205#elif defined(OS_ANDROID) 206static const char kFDDir[] = "/proc/self/fd"; 207#endif 208 209void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { 210 // DANGER: no calls to malloc or locks are allowed from now on: 211 // http://crbug.com/36678 212 213 // Get the maximum number of FDs possible. 214 size_t max_fds = GetMaxFds(); 215 216 DirReaderPosix fd_dir(kFDDir); 217 if (!fd_dir.IsValid()) { 218 // Fallback case: Try every possible fd. 219 for (size_t i = 0; i < max_fds; ++i) { 220 const int fd = static_cast<int>(i); 221 if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO) 222 continue; 223 // Cannot use STL iterators here, since debug iterators use locks. 224 size_t j; 225 for (j = 0; j < saved_mapping.size(); j++) { 226 if (fd == saved_mapping[j].dest) 227 break; 228 } 229 if (j < saved_mapping.size()) 230 continue; 231 232 // Since we're just trying to close anything we can find, 233 // ignore any error return values of close(). 234 close(fd); 235 } 236 return; 237 } 238 239 const int dir_fd = fd_dir.fd(); 240 241 for ( ; fd_dir.Next(); ) { 242 // Skip . and .. entries. 243 if (fd_dir.name()[0] == '.') 244 continue; 245 246 char *endptr; 247 errno = 0; 248 const long int fd = strtol(fd_dir.name(), &endptr, 10); 249 if (fd_dir.name()[0] == 0 || *endptr || fd < 0 || errno) 250 continue; 251 if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO) 252 continue; 253 // Cannot use STL iterators here, since debug iterators use locks. 254 size_t i; 255 for (i = 0; i < saved_mapping.size(); i++) { 256 if (fd == saved_mapping[i].dest) 257 break; 258 } 259 if (i < saved_mapping.size()) 260 continue; 261 if (fd == dir_fd) 262 continue; 263 264 // When running under Valgrind, Valgrind opens several FDs for its 265 // own use and will complain if we try to close them. All of 266 // these FDs are >= |max_fds|, so we can check against that here 267 // before closing. See https://bugs.kde.org/show_bug.cgi?id=191758 268 if (fd < static_cast<int>(max_fds)) { 269 int ret = IGNORE_EINTR(close(fd)); 270 DPCHECK(ret == 0); 271 } 272 } 273} 274 275bool LaunchProcess(const std::vector<std::string>& argv, 276 const LaunchOptions& options, 277 ProcessHandle* process_handle) { 278 size_t fd_shuffle_size = 0; 279 if (options.fds_to_remap) { 280 fd_shuffle_size = options.fds_to_remap->size(); 281 } 282 283 InjectiveMultimap fd_shuffle1; 284 InjectiveMultimap fd_shuffle2; 285 fd_shuffle1.reserve(fd_shuffle_size); 286 fd_shuffle2.reserve(fd_shuffle_size); 287 288 scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]); 289 scoped_ptr<char*[]> new_environ; 290 if (!options.environ.empty()) 291 new_environ = AlterEnvironment(GetEnvironment(), options.environ); 292 293 sigset_t full_sigset; 294 sigfillset(&full_sigset); 295 const sigset_t orig_sigmask = SetSignalMask(full_sigset); 296 297 pid_t pid; 298#if defined(OS_LINUX) 299 if (options.clone_flags) { 300 // Signal handling in this function assumes the creation of a new 301 // process, so we check that a thread is not being created by mistake 302 // and that signal handling follows the process-creation rules. 303 RAW_CHECK( 304 !(options.clone_flags & (CLONE_SIGHAND | CLONE_THREAD | CLONE_VM))); 305 pid = syscall(__NR_clone, options.clone_flags, 0, 0, 0); 306 } else 307#endif 308 { 309 pid = fork(); 310 } 311 312 // Always restore the original signal mask in the parent. 313 if (pid != 0) { 314 SetSignalMask(orig_sigmask); 315 } 316 317 if (pid < 0) { 318 DPLOG(ERROR) << "fork"; 319 return false; 320 } else if (pid == 0) { 321 // Child process 322 323 // DANGER: no calls to malloc or locks are allowed from now on: 324 // http://crbug.com/36678 325 326 // DANGER: fork() rule: in the child, if you don't end up doing exec*(), 327 // you call _exit() instead of exit(). This is because _exit() does not 328 // call any previously-registered (in the parent) exit handlers, which 329 // might do things like block waiting for threads that don't even exist 330 // in the child. 331 332 // If a child process uses the readline library, the process block forever. 333 // In BSD like OSes including OS X it is safe to assign /dev/null as stdin. 334 // See http://crbug.com/56596. 335 int null_fd = HANDLE_EINTR(open("/dev/null", O_RDONLY)); 336 if (null_fd < 0) { 337 RAW_LOG(ERROR, "Failed to open /dev/null"); 338 _exit(127); 339 } 340 341 file_util::ScopedFD null_fd_closer(&null_fd); 342 int new_fd = HANDLE_EINTR(dup2(null_fd, STDIN_FILENO)); 343 if (new_fd != STDIN_FILENO) { 344 RAW_LOG(ERROR, "Failed to dup /dev/null for stdin"); 345 _exit(127); 346 } 347 348 if (options.new_process_group) { 349 // Instead of inheriting the process group ID of the parent, the child 350 // starts off a new process group with pgid equal to its process ID. 351 if (setpgid(0, 0) < 0) { 352 RAW_LOG(ERROR, "setpgid failed"); 353 _exit(127); 354 } 355 } 356 357 // Stop type-profiler. 358 // The profiler should be stopped between fork and exec since it inserts 359 // locks at new/delete expressions. See http://crbug.com/36678. 360 base::type_profiler::Controller::Stop(); 361 362 if (options.maximize_rlimits) { 363 // Some resource limits need to be maximal in this child. 364 for (size_t i = 0; i < options.maximize_rlimits->size(); ++i) { 365 const int resource = (*options.maximize_rlimits)[i]; 366 struct rlimit limit; 367 if (getrlimit(resource, &limit) < 0) { 368 RAW_LOG(WARNING, "getrlimit failed"); 369 } else if (limit.rlim_cur < limit.rlim_max) { 370 limit.rlim_cur = limit.rlim_max; 371 if (setrlimit(resource, &limit) < 0) { 372 RAW_LOG(WARNING, "setrlimit failed"); 373 } 374 } 375 } 376 } 377 378#if defined(OS_MACOSX) 379 RestoreDefaultExceptionHandler(); 380#endif // defined(OS_MACOSX) 381 382 ResetChildSignalHandlersToDefaults(); 383 SetSignalMask(orig_sigmask); 384 385#if 0 386 // When debugging it can be helpful to check that we really aren't making 387 // any hidden calls to malloc. 388 void *malloc_thunk = 389 reinterpret_cast<void*>(reinterpret_cast<intptr_t>(malloc) & ~4095); 390 mprotect(malloc_thunk, 4096, PROT_READ | PROT_WRITE | PROT_EXEC); 391 memset(reinterpret_cast<void*>(malloc), 0xff, 8); 392#endif // 0 393 394#if defined(OS_CHROMEOS) 395 if (options.ctrl_terminal_fd >= 0) { 396 // Set process' controlling terminal. 397 if (HANDLE_EINTR(setsid()) != -1) { 398 if (HANDLE_EINTR( 399 ioctl(options.ctrl_terminal_fd, TIOCSCTTY, NULL)) == -1) { 400 RAW_LOG(WARNING, "ioctl(TIOCSCTTY), ctrl terminal not set"); 401 } 402 } else { 403 RAW_LOG(WARNING, "setsid failed, ctrl terminal not set"); 404 } 405 } 406#endif // defined(OS_CHROMEOS) 407 408 if (options.fds_to_remap) { 409 // Cannot use STL iterators here, since debug iterators use locks. 410 for (size_t i = 0; i < options.fds_to_remap->size(); ++i) { 411 const FileHandleMappingVector::value_type& value = 412 (*options.fds_to_remap)[i]; 413 fd_shuffle1.push_back(InjectionArc(value.first, value.second, false)); 414 fd_shuffle2.push_back(InjectionArc(value.first, value.second, false)); 415 } 416 } 417 418 if (!options.environ.empty()) 419 SetEnvironment(new_environ.get()); 420 421 // fd_shuffle1 is mutated by this call because it cannot malloc. 422 if (!ShuffleFileDescriptors(&fd_shuffle1)) 423 _exit(127); 424 425 CloseSuperfluousFds(fd_shuffle2); 426 427 for (size_t i = 0; i < argv.size(); i++) 428 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); 429 argv_cstr[argv.size()] = NULL; 430 execvp(argv_cstr[0], argv_cstr.get()); 431 432 RAW_LOG(ERROR, "LaunchProcess: failed to execvp:"); 433 RAW_LOG(ERROR, argv_cstr[0]); 434 _exit(127); 435 } else { 436 // Parent process 437 if (options.wait) { 438 // While this isn't strictly disk IO, waiting for another process to 439 // finish is the sort of thing ThreadRestrictions is trying to prevent. 440 base::ThreadRestrictions::AssertIOAllowed(); 441 pid_t ret = HANDLE_EINTR(waitpid(pid, 0, 0)); 442 DPCHECK(ret > 0); 443 } 444 445 if (process_handle) 446 *process_handle = pid; 447 } 448 449 return true; 450} 451 452 453bool LaunchProcess(const CommandLine& cmdline, 454 const LaunchOptions& options, 455 ProcessHandle* process_handle) { 456 return LaunchProcess(cmdline.argv(), options, process_handle); 457} 458 459void RaiseProcessToHighPriority() { 460 // On POSIX, we don't actually do anything here. We could try to nice() or 461 // setpriority() or sched_getscheduler, but these all require extra rights. 462} 463 464// Return value used by GetAppOutputInternal to encapsulate the various exit 465// scenarios from the function. 466enum GetAppOutputInternalResult { 467 EXECUTE_FAILURE, 468 EXECUTE_SUCCESS, 469 GOT_MAX_OUTPUT, 470}; 471 472// Executes the application specified by |argv| and wait for it to exit. Stores 473// the output (stdout) in |output|. If |do_search_path| is set, it searches the 474// path for the application; in that case, |envp| must be null, and it will use 475// the current environment. If |do_search_path| is false, |argv[0]| should fully 476// specify the path of the application, and |envp| will be used as the 477// environment. Redirects stderr to /dev/null. 478// If we successfully start the application and get all requested output, we 479// return GOT_MAX_OUTPUT, or if there is a problem starting or exiting 480// the application we return RUN_FAILURE. Otherwise we return EXECUTE_SUCCESS. 481// The GOT_MAX_OUTPUT return value exists so a caller that asks for limited 482// output can treat this as a success, despite having an exit code of SIG_PIPE 483// due to us closing the output pipe. 484// In the case of EXECUTE_SUCCESS, the application exit code will be returned 485// in |*exit_code|, which should be checked to determine if the application 486// ran successfully. 487static GetAppOutputInternalResult GetAppOutputInternal( 488 const std::vector<std::string>& argv, 489 char* const envp[], 490 std::string* output, 491 size_t max_output, 492 bool do_search_path, 493 int* exit_code) { 494 // Doing a blocking wait for another command to finish counts as IO. 495 base::ThreadRestrictions::AssertIOAllowed(); 496 // exit_code must be supplied so calling function can determine success. 497 DCHECK(exit_code); 498 *exit_code = EXIT_FAILURE; 499 500 int pipe_fd[2]; 501 pid_t pid; 502 InjectiveMultimap fd_shuffle1, fd_shuffle2; 503 scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]); 504 505 fd_shuffle1.reserve(3); 506 fd_shuffle2.reserve(3); 507 508 // Either |do_search_path| should be false or |envp| should be null, but not 509 // both. 510 DCHECK(!do_search_path ^ !envp); 511 512 if (pipe(pipe_fd) < 0) 513 return EXECUTE_FAILURE; 514 515 switch (pid = fork()) { 516 case -1: // error 517 close(pipe_fd[0]); 518 close(pipe_fd[1]); 519 return EXECUTE_FAILURE; 520 case 0: // child 521 { 522 // DANGER: no calls to malloc or locks are allowed from now on: 523 // http://crbug.com/36678 524 525#if defined(OS_MACOSX) 526 RestoreDefaultExceptionHandler(); 527#endif 528 529 // Obscure fork() rule: in the child, if you don't end up doing exec*(), 530 // you call _exit() instead of exit(). This is because _exit() does not 531 // call any previously-registered (in the parent) exit handlers, which 532 // might do things like block waiting for threads that don't even exist 533 // in the child. 534 int dev_null = open("/dev/null", O_WRONLY); 535 if (dev_null < 0) 536 _exit(127); 537 538 // Stop type-profiler. 539 // The profiler should be stopped between fork and exec since it inserts 540 // locks at new/delete expressions. See http://crbug.com/36678. 541 base::type_profiler::Controller::Stop(); 542 543 fd_shuffle1.push_back(InjectionArc(pipe_fd[1], STDOUT_FILENO, true)); 544 fd_shuffle1.push_back(InjectionArc(dev_null, STDERR_FILENO, true)); 545 fd_shuffle1.push_back(InjectionArc(dev_null, STDIN_FILENO, true)); 546 // Adding another element here? Remeber to increase the argument to 547 // reserve(), above. 548 549 for (size_t i = 0; i < fd_shuffle1.size(); ++i) 550 fd_shuffle2.push_back(fd_shuffle1[i]); 551 552 if (!ShuffleFileDescriptors(&fd_shuffle1)) 553 _exit(127); 554 555 CloseSuperfluousFds(fd_shuffle2); 556 557 for (size_t i = 0; i < argv.size(); i++) 558 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); 559 argv_cstr[argv.size()] = NULL; 560 if (do_search_path) 561 execvp(argv_cstr[0], argv_cstr.get()); 562 else 563 execve(argv_cstr[0], argv_cstr.get(), envp); 564 _exit(127); 565 } 566 default: // parent 567 { 568 // Close our writing end of pipe now. Otherwise later read would not 569 // be able to detect end of child's output (in theory we could still 570 // write to the pipe). 571 close(pipe_fd[1]); 572 573 output->clear(); 574 char buffer[256]; 575 size_t output_buf_left = max_output; 576 ssize_t bytes_read = 1; // A lie to properly handle |max_output == 0| 577 // case in the logic below. 578 579 while (output_buf_left > 0) { 580 bytes_read = HANDLE_EINTR(read(pipe_fd[0], buffer, 581 std::min(output_buf_left, sizeof(buffer)))); 582 if (bytes_read <= 0) 583 break; 584 output->append(buffer, bytes_read); 585 output_buf_left -= static_cast<size_t>(bytes_read); 586 } 587 close(pipe_fd[0]); 588 589 // Always wait for exit code (even if we know we'll declare 590 // GOT_MAX_OUTPUT). 591 bool success = WaitForExitCode(pid, exit_code); 592 593 // If we stopped because we read as much as we wanted, we return 594 // GOT_MAX_OUTPUT (because the child may exit due to |SIGPIPE|). 595 if (!output_buf_left && bytes_read > 0) 596 return GOT_MAX_OUTPUT; 597 else if (success) 598 return EXECUTE_SUCCESS; 599 return EXECUTE_FAILURE; 600 } 601 } 602} 603 604bool GetAppOutput(const CommandLine& cl, std::string* output) { 605 return GetAppOutput(cl.argv(), output); 606} 607 608bool GetAppOutput(const std::vector<std::string>& argv, std::string* output) { 609 // Run |execve()| with the current environment and store "unlimited" data. 610 int exit_code; 611 GetAppOutputInternalResult result = GetAppOutputInternal( 612 argv, NULL, output, std::numeric_limits<std::size_t>::max(), true, 613 &exit_code); 614 return result == EXECUTE_SUCCESS && exit_code == EXIT_SUCCESS; 615} 616 617// TODO(viettrungluu): Conceivably, we should have a timeout as well, so we 618// don't hang if what we're calling hangs. 619bool GetAppOutputRestricted(const CommandLine& cl, 620 std::string* output, size_t max_output) { 621 // Run |execve()| with the empty environment. 622 char* const empty_environ = NULL; 623 int exit_code; 624 GetAppOutputInternalResult result = GetAppOutputInternal( 625 cl.argv(), &empty_environ, output, max_output, false, &exit_code); 626 return result == GOT_MAX_OUTPUT || (result == EXECUTE_SUCCESS && 627 exit_code == EXIT_SUCCESS); 628} 629 630bool GetAppOutputWithExitCode(const CommandLine& cl, 631 std::string* output, 632 int* exit_code) { 633 // Run |execve()| with the current environment and store "unlimited" data. 634 GetAppOutputInternalResult result = GetAppOutputInternal( 635 cl.argv(), NULL, output, std::numeric_limits<std::size_t>::max(), true, 636 exit_code); 637 return result == EXECUTE_SUCCESS; 638} 639 640} // namespace base 641