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 linux_sandbox->set_exiting_before_initialize_sandbox(true); | |
James Cook
2017/04/27 22:30:23
If I don't do something like this I hit the CHECK(
mdempsky
2017/04/27 22:50:45
Since this is security sensitive code, I'd prefer
James Cook
2017/04/28 02:39:48
Sounds good. Done.
| |
628 return false; | |
629 } | |
624 } | 630 } |
625 | 631 |
626 VLOG(1) << "ZygoteMain: initializing " << fork_delegates.size() | 632 VLOG(1) << "ZygoteMain: initializing " << fork_delegates.size() |
627 << " fork delegates"; | 633 << " fork delegates"; |
628 for (const auto& fork_delegate : fork_delegates) { | 634 for (const auto& fork_delegate : fork_delegates) { |
629 fork_delegate->Init(GetSandboxFD(), using_layer1_sandbox); | 635 fork_delegate->Init(GetSandboxFD(), using_layer1_sandbox); |
630 } | 636 } |
631 | 637 |
632 const std::vector<int> sandbox_fds_to_close_post_fork = | 638 const std::vector<int> sandbox_fds_to_close_post_fork = |
633 linux_sandbox->GetFileDescriptorsToClose(); | 639 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; | 676 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; |
671 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); | 677 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); |
672 | 678 |
673 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, | 679 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, |
674 extra_fds); | 680 extra_fds); |
675 // This function call can return multiple times, once per fork(). | 681 // This function call can return multiple times, once per fork(). |
676 return zygote.ProcessRequests(); | 682 return zygote.ProcessRequests(); |
677 } | 683 } |
678 | 684 |
679 } // namespace content | 685 } // namespace content |
OLD | NEW |