Commit 11ab394e authored by Matt Giuca's avatar Matt Giuca Committed by Commit Bot

Revert "Handle error return from zygote recvmsg call."

This reverts commit 86ed44e0.

Reason for revert: Blocking revert of r554902.

Original change's description:
> Handle error return from zygote recvmsg call.
> 
> This trips a check far away from the actual issue. The CHECK is too
> strong and prevents executing the error handling path beneath it.
> 
> Shuffle a few blocks and comments around so that the flow makes
> more sense and is easier to read, and initial fork failures are
> caught earlier.
> 
> Bug: 835778
> Change-Id: I46b960f9fd1095f5fc5224bf9cc80703e8fc325f
> Reviewed-on: https://chromium-review.googlesource.com/1030876
> Commit-Queue: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#554949}

TBR=dcheng@chromium.org,jln@chromium.org,jam@chromium.org,tsepez@chromium.org

Change-Id: I877d3610bd75eaa1176189319923bcc75b794781
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 835778, 838498
Reviewed-on: https://chromium-review.googlesource.com/1036983Reviewed-by: default avatarMatt Giuca <mgiuca@chromium.org>
Commit-Queue: Matt Giuca <mgiuca@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554999}
parent 7803ea93
......@@ -438,8 +438,6 @@ int Zygote::ForkWithRealPid(const std::string& process_type,
}
if (pid == 0) {
// In the child process.
// If the process is the init process inside a PID namespace, it must have
// explicit signal handlers.
if (getpid() == 1) {
......@@ -451,6 +449,7 @@ int Zygote::ForkWithRealPid(const std::string& process_type,
}
}
// In the child process.
write_pipe.reset();
// Ping the PID oracle socket so the browser can find our PID.
......@@ -477,34 +476,32 @@ int Zygote::ForkWithRealPid(const std::string& process_type,
}
// In the parent process.
if (pid < 0) {
// Fork failed.
return -1;
}
read_pipe.reset();
pid_oracle.reset();
// Always receive a real PID from the zygote host, though it might
// be invalid (see below).
base::ProcessId real_pid = -1;
base::ProcessId real_pid;
{
std::vector<base::ScopedFD> recv_fds;
char buf[kZygoteMaxMessageLength];
const ssize_t len = base::UnixDomainSocket::RecvMsg(
kZygoteSocketPairFd, buf, sizeof(buf), &recv_fds);
CHECK_GT(len, 0);
CHECK(recv_fds.empty());
if (len > 0) {
CHECK(recv_fds.empty());
base::Pickle pickle(buf, len);
base::PickleIterator iter(pickle);
base::Pickle pickle(buf, len);
base::PickleIterator iter(pickle);
int kind;
CHECK(iter.ReadInt(&kind));
CHECK(kind == kZygoteCommandForkRealPID);
CHECK(iter.ReadInt(&real_pid));
}
int kind;
CHECK(iter.ReadInt(&kind));
CHECK(kind == kZygoteCommandForkRealPID);
CHECK(iter.ReadInt(&real_pid));
}
// Fork failed.
if (pid < 0) {
return -1;
}
// If we successfully forked a child, but it crashed without sending
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment