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 } | |
444 std::vector<int> fds; | 439 std::vector<int> fds; |
445 fds.push_back(ipc_channel_fd); // kBrowserFDIndex | 440 fds.push_back(ipc_channel_fd); // kBrowserFDIndex |
446 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex | 441 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex |
447 fds.push_back(mojo_channel_fd); // kMojoParentFDIndex | |
448 pid = helper->Fork(process_type, fds, channel_id); | 442 pid = helper->Fork(process_type, fds, channel_id); |
449 | 443 |
450 // Helpers should never return in the child process. | 444 // Helpers should never return in the child process. |
451 CHECK_NE(pid, 0); | 445 CHECK_NE(pid, 0); |
452 } else { | 446 } else { |
453 CreatePipe(&read_pipe, &write_pipe); | 447 CreatePipe(&read_pipe, &write_pipe); |
454 if (sandbox_flags_ & kSandboxLinuxPIDNS && | 448 if (sandbox_flags_ & kSandboxLinuxPIDNS && |
455 sandbox_flags_ & kSandboxLinuxUserNS) { | 449 sandbox_flags_ & kSandboxLinuxUserNS) { |
456 pid = sandbox::NamespaceSandbox::ForkInNewPidNamespace( | 450 pid = sandbox::NamespaceSandbox::ForkInNewPidNamespace( |
457 /*drop_capabilities_in_child=*/true); | 451 /*drop_capabilities_in_child=*/true); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { | 665 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { |
672 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 666 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
673 sizeof(sandbox_flags_)) { | 667 sizeof(sandbox_flags_)) { |
674 PLOG(ERROR) << "write"; | 668 PLOG(ERROR) << "write"; |
675 } | 669 } |
676 | 670 |
677 return false; | 671 return false; |
678 } | 672 } |
679 | 673 |
680 } // namespace content | 674 } // namespace content |
OLD | NEW |