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_main.h" | 5 #include "content/zygote/zygote_main.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 sandbox::NamespaceSandbox::InNewUserNamespace(); | 610 sandbox::NamespaceSandbox::InNewUserNamespace(); |
611 const bool using_layer1_sandbox = | 611 const bool using_layer1_sandbox = |
612 using_setuid_sandbox || using_namespace_sandbox; | 612 using_setuid_sandbox || using_namespace_sandbox; |
613 | 613 |
614 if (using_setuid_sandbox) { | 614 if (using_setuid_sandbox) { |
615 linux_sandbox->setuid_sandbox_client()->CloseDummyFile(); | 615 linux_sandbox->setuid_sandbox_client()->CloseDummyFile(); |
616 } | 616 } |
617 | 617 |
618 if (using_layer1_sandbox) { | 618 if (using_layer1_sandbox) { |
619 // Let the ZygoteHost know we're booting up. | 619 // Let the ZygoteHost know we're booting up. |
620 CHECK(base::UnixDomainSocket::SendMsg(kZygoteSocketPairFd, | 620 if (!base::UnixDomainSocket::SendMsg( |
621 kZygoteBootMessage, | 621 kZygoteSocketPairFd, kZygoteBootMessage, sizeof(kZygoteBootMessage), |
622 sizeof(kZygoteBootMessage), | 622 std::vector<int>())) { |
623 std::vector<int>())); | 623 // This is not a CHECK failure because the browser process could either |
| 624 // crash or quickly exit while the zygote is starting. In either case a |
| 625 // zygote crash is not useful. http://crbug.com/692227 |
| 626 PLOG(ERROR) << "Failed sending zygote boot message"; |
| 627 _exit(1); |
| 628 } |
624 } | 629 } |
625 | 630 |
626 VLOG(1) << "ZygoteMain: initializing " << fork_delegates.size() | 631 VLOG(1) << "ZygoteMain: initializing " << fork_delegates.size() |
627 << " fork delegates"; | 632 << " fork delegates"; |
628 for (const auto& fork_delegate : fork_delegates) { | 633 for (const auto& fork_delegate : fork_delegates) { |
629 fork_delegate->Init(GetSandboxFD(), using_layer1_sandbox); | 634 fork_delegate->Init(GetSandboxFD(), using_layer1_sandbox); |
630 } | 635 } |
631 | 636 |
632 const std::vector<int> sandbox_fds_to_close_post_fork = | 637 const std::vector<int> sandbox_fds_to_close_post_fork = |
633 linux_sandbox->GetFileDescriptorsToClose(); | 638 linux_sandbox->GetFileDescriptorsToClose(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; | 675 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; |
671 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); | 676 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); |
672 | 677 |
673 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, | 678 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, |
674 extra_fds); | 679 extra_fds); |
675 // This function call can return multiple times, once per fork(). | 680 // This function call can return multiple times, once per fork(). |
676 return zygote.ProcessRequests(); | 681 return zygote.ProcessRequests(); |
677 } | 682 } |
678 | 683 |
679 } // namespace content | 684 } // namespace content |
OLD | NEW |