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

Side by Side Diff: chrome/nacl/nacl_fork_delegate_linux.cc

Issue 7779029: Revert 99617 - Fix nacl_helper startup bug with command line construction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_exe.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/common/nacl_fork_delegate_linux.h" 5 #include "chrome/common/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/socket.h> 9 #include <sys/socket.h>
10 10
(...skipping 28 matching lines...) Expand all
39 // Confirm a couple hard-wired assumptions. 39 // Confirm a couple hard-wired assumptions.
40 // The NaCl constants are from chrome/nacl/nacl_linux_helper.h 40 // The NaCl constants are from chrome/nacl/nacl_linux_helper.h
41 DCHECK(kNaClBrowserDescriptor == browserdesc); 41 DCHECK(kNaClBrowserDescriptor == browserdesc);
42 DCHECK(kNaClSandboxDescriptor == sandboxdesc); 42 DCHECK(kNaClSandboxDescriptor == sandboxdesc);
43 43
44 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); 44 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
45 base::file_handle_mapping_vector fds_to_map; 45 base::file_handle_mapping_vector fds_to_map;
46 fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor)); 46 fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor));
47 fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor)); 47 fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor));
48 ready_ = false; 48 ready_ = false;
49 return; // Disable nacl_helper while fixing some issues.
50
49 FilePath helper_exe; 51 FilePath helper_exe;
50 FilePath helper_bootstrap_exe; 52 FilePath helper_bootstrap_exe;
51 if (PathService::Get(chrome::FILE_NACL_HELPER, &helper_exe) && 53 if (PathService::Get(chrome::FILE_NACL_HELPER, &helper_exe) &&
52 PathService::Get(chrome::FILE_NACL_HELPER_BOOTSTRAP, 54 PathService::Get(chrome::FILE_NACL_HELPER_BOOTSTRAP,
53 &helper_bootstrap_exe) && 55 &helper_bootstrap_exe) &&
54 !RunningOnValgrind()) { 56 !RunningOnValgrind()) {
55 CommandLine cmd_line(helper_bootstrap_exe); 57 CommandLine::StringVector argv = CommandLine::ForCurrentProcess()->argv();
56 cmd_line.AppendArgPath(helper_exe); 58 argv[0] = helper_bootstrap_exe.value();
57 cmd_line.AppendArgNative(kNaClHelperAtZero); 59 argv[1] = helper_exe.value();
60 argv[2] = kNaClHelperAtZero;
58 base::LaunchOptions options; 61 base::LaunchOptions options;
59 options.fds_to_remap = &fds_to_map; 62 options.fds_to_remap = &fds_to_map;
60 options.clone_flags = CLONE_FS | SIGCHLD; 63 options.clone_flags = CLONE_FS | SIGCHLD;
61 ready_ = base::LaunchProcess(cmd_line.argv(), options, NULL); 64 ready_ = base::LaunchProcess(argv, options, NULL);
62 // parent and error cases are handled below 65 // parent and error cases are handled below
63 } 66 }
64 if (HANDLE_EINTR(close(fds[1])) != 0) 67 if (HANDLE_EINTR(close(fds[1])) != 0)
65 LOG(ERROR) << "close(fds[1]) failed"; 68 LOG(ERROR) << "close(fds[1]) failed";
66 if (ready_) { 69 if (ready_) {
67 const ssize_t kExpectedLength = strlen(kNaClHelperStartupAck); 70 const ssize_t kExpectedLength = strlen(kNaClHelperStartupAck);
68 char buf[kExpectedLength]; 71 char buf[kExpectedLength];
69 72
70 // Wait for ack from nacl_helper, indicating it is ready to help 73 // Wait for ack from nacl_helper, indicating it is ready to help
71 const ssize_t nread = HANDLE_EINTR(read(fds[0], buf, sizeof(buf))); 74 const ssize_t nread = HANDLE_EINTR(read(fds[0], buf, sizeof(buf)));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 121
119 bool NaClForkDelegate::AckChild(const int fd, 122 bool NaClForkDelegate::AckChild(const int fd,
120 const std::string& channel_switch) { 123 const std::string& channel_switch) {
121 int nwritten = HANDLE_EINTR(write(fd, channel_switch.c_str(), 124 int nwritten = HANDLE_EINTR(write(fd, channel_switch.c_str(),
122 channel_switch.length())); 125 channel_switch.length()));
123 if (nwritten != static_cast<int>(channel_switch.length())) { 126 if (nwritten != static_cast<int>(channel_switch.length())) {
124 return false; 127 return false;
125 } 128 }
126 return true; 129 return true;
127 } 130 }
OLDNEW
« no previous file with comments | « chrome/chrome_exe.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698