| 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 "content/zygote/zygote_linux.h" | 5 #include "content/zygote/zygote_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <poll.h> | 9 #include <poll.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 429 } |
| 430 | 430 |
| 431 base::ScopedFD read_pipe, write_pipe; | 431 base::ScopedFD read_pipe, write_pipe; |
| 432 base::ProcessId pid = 0; | 432 base::ProcessId pid = 0; |
| 433 if (helper) { | 433 if (helper) { |
| 434 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel); | 434 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel); |
| 435 if (ipc_channel_fd < 0) { | 435 if (ipc_channel_fd < 0) { |
| 436 DLOG(ERROR) << "Failed to find kPrimaryIPCChannel in FD mapping"; | 436 DLOG(ERROR) << "Failed to find kPrimaryIPCChannel in FD mapping"; |
| 437 return -1; | 437 return -1; |
| 438 } | 438 } |
| 439 int mojo_channel_fd = LookUpFd(fd_mapping, kMojoIPCChannel); |
| 440 if (mojo_channel_fd < 0) { |
| 441 DLOG(ERROR) << "Failed to find kMojoIPCChannel in FD mapping"; |
| 442 return -1; |
| 443 } |
| 439 std::vector<int> fds; | 444 std::vector<int> fds; |
| 440 fds.push_back(ipc_channel_fd); // kBrowserFDIndex | 445 fds.push_back(ipc_channel_fd); // kBrowserFDIndex |
| 441 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex | 446 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex |
| 447 fds.push_back(mojo_channel_fd); // kMojoParentFDIndex |
| 442 pid = helper->Fork(process_type, fds, channel_id); | 448 pid = helper->Fork(process_type, fds, channel_id); |
| 443 | 449 |
| 444 // Helpers should never return in the child process. | 450 // Helpers should never return in the child process. |
| 445 CHECK_NE(pid, 0); | 451 CHECK_NE(pid, 0); |
| 446 } else { | 452 } else { |
| 447 CreatePipe(&read_pipe, &write_pipe); | 453 CreatePipe(&read_pipe, &write_pipe); |
| 448 if (sandbox_flags_ & kSandboxLinuxPIDNS && | 454 if (sandbox_flags_ & kSandboxLinuxPIDNS && |
| 449 sandbox_flags_ & kSandboxLinuxUserNS) { | 455 sandbox_flags_ & kSandboxLinuxUserNS) { |
| 450 pid = sandbox::NamespaceSandbox::ForkInNewPidNamespace( | 456 pid = sandbox::NamespaceSandbox::ForkInNewPidNamespace( |
| 451 /*drop_capabilities_in_child=*/true); | 457 /*drop_capabilities_in_child=*/true); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { | 671 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { |
| 666 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 672 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
| 667 sizeof(sandbox_flags_)) { | 673 sizeof(sandbox_flags_)) { |
| 668 PLOG(ERROR) << "write"; | 674 PLOG(ERROR) << "write"; |
| 669 } | 675 } |
| 670 | 676 |
| 671 return false; | 677 return false; |
| 672 } | 678 } |
| 673 | 679 |
| 674 } // namespace content | 680 } // namespace content |
| OLD | NEW |