Chromium Code Reviews| Index: components/nacl/loader/nacl_helper_linux.cc |
| diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc |
| index eaf6204d69673cddd343fdaf58f91044f57f8499..5204c5a8e5831f0fac7253a2bb9b9bea0fd8aaa0 100644 |
| --- a/components/nacl/loader/nacl_helper_linux.cc |
| +++ b/components/nacl/loader/nacl_helper_linux.cc |
| @@ -114,41 +114,23 @@ void ChildNaClLoaderInit(ScopedVector<base::ScopedFD> child_fds, |
| bool uses_nonsfi_mode, |
| nacl::NaClSandbox* nacl_sandbox, |
| const std::string& channel_id) { |
| - bool validack = false; |
| - base::ProcessId real_pid; |
| - // Wait until the parent process has discovered our PID. We |
| - // should not fork any child processes (which the seccomp |
| - // sandbox does) until then, because that can interfere with the |
| - // parent's discovery of our PID. |
| - const ssize_t nread = HANDLE_EINTR( |
| - read(child_fds[content::ZygoteForkDelegate::kParentFDIndex]->get(), |
| - &real_pid, |
| - sizeof(real_pid))); |
| - if (static_cast<size_t>(nread) == sizeof(real_pid)) { |
| - // Make sure the parent didn't accidentally send us our real PID. |
| - // We don't want it to be discoverable anywhere in our address space |
| - // when we start running untrusted code. |
| - CHECK(real_pid == 0); |
| - |
| - CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| - switches::kProcessChannelID, channel_id); |
| - validack = true; |
| - } else { |
| - if (nread < 0) |
| - perror("read"); |
| - LOG(ERROR) << "read returned " << nread; |
| - } |
| + // Ping the PID oracle socket. |
| + CHECK(UnixDomainSocket::SendMsg( |
| + child_fds[content::ZygoteForkDelegate::kPIDOracleFDIndex]->get(), |
| + "x", |
|
jln (very slow on Chromium)
2014/05/02 18:25:00
Let's make this a defined constant and check for i
mdempsky
2014/05/02 20:23:09
Yep, I just used a dummy string constant for proof
mdempsky
2014/05/02 23:36:01
Done.
|
| + 1, |
| + std::vector<int>())); |
| + |
| + CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + switches::kProcessChannelID, channel_id); |
| + // Save the browser socket and close the rest. |
| base::ScopedFD browser_fd( |
| child_fds[content::ZygoteForkDelegate::kBrowserFDIndex]->Pass()); |
| child_fds.clear(); |
| - if (validack) { |
| - BecomeNaClLoader( |
| - browser_fd.Pass(), system_info, uses_nonsfi_mode, nacl_sandbox); |
| - } else { |
| - LOG(ERROR) << "Failed to synch with zygote"; |
| - } |
| + BecomeNaClLoader( |
| + browser_fd.Pass(), system_info, uses_nonsfi_mode, nacl_sandbox); |
| _exit(1); |
| } |