| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/zygote_host_impl_linux.h" | 5 #include "content/browser/zygote_host_impl_linux.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 <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 action.sa_handler = SIGCHLDHandler; | 117 action.sa_handler = SIGCHLDHandler; |
| 118 CHECK(sigaction(SIGCHLD, &action, NULL) == 0); | 118 CHECK(sigaction(SIGCHLD, &action, NULL) == 0); |
| 119 | 119 |
| 120 if (g_suid_sandbox_active) { | 120 if (g_suid_sandbox_active) { |
| 121 // Let the ZygoteHost know we are ready to go. | 121 // Let the ZygoteHost know we are ready to go. |
| 122 // The receiving code is in content/browser/zygote_host_linux.cc. | 122 // The receiving code is in content/browser/zygote_host_linux.cc. |
| 123 std::vector<int> empty; | 123 std::vector<int> empty; |
| 124 bool r = UnixDomainSocket::SendMsg(kBrowserDescriptor, kZygoteMagic, | 124 bool r = UnixDomainSocket::SendMsg(kBrowserDescriptor, kZygoteMagic, |
| 125 sizeof(kZygoteMagic), empty); | 125 sizeof(kZygoteMagic), empty); |
| 126 #if defined(OS_CHROMEOS) | 126 #if defined(OS_CHROMEOS) |
| 127 LOG_IF(WARNING, r) << "Sending zygote magic failed"; | 127 LOG_IF(WARNING, !r) << "Sending zygote magic failed"; |
| 128 // Exit normally on chromeos because session manager may send SIGTERM | 128 // Exit normally on chromeos because session manager may send SIGTERM |
| 129 // right after the process starts and it may fail to send zygote magic | 129 // right after the process starts and it may fail to send zygote magic |
| 130 // number to browser process. | 130 // number to browser process. |
| 131 if (!r) | 131 if (!r) |
| 132 _exit(content::RESULT_CODE_NORMAL_EXIT); | 132 _exit(content::RESULT_CODE_NORMAL_EXIT); |
| 133 #else | 133 #else |
| 134 CHECK(r) << "Sending zygote magic failed"; | 134 CHECK(r) << "Sending zygote magic failed"; |
| 135 #endif | 135 #endif |
| 136 } | 136 } |
| 137 | 137 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 869 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
| 870 sandbox_flags |= ZygoteHostImpl::kSandboxSeccomp; | 870 sandbox_flags |= ZygoteHostImpl::kSandboxSeccomp; |
| 871 } | 871 } |
| 872 } | 872 } |
| 873 #endif // SECCOMP_SANDBOX | 873 #endif // SECCOMP_SANDBOX |
| 874 | 874 |
| 875 Zygote zygote(sandbox_flags, forkdelegate); | 875 Zygote zygote(sandbox_flags, forkdelegate); |
| 876 // This function call can return multiple times, once per fork(). | 876 // This function call can return multiple times, once per fork(). |
| 877 return zygote.ProcessRequests(); | 877 return zygote.ProcessRequests(); |
| 878 } | 878 } |
| OLD | NEW |