| 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/browser/zygote_host/zygote_host_impl_linux.h" | 5 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 options.fds_to_remap = &fds_to_map; | 176 options.fds_to_remap = &fds_to_map; |
| 177 base::Process process = | 177 base::Process process = |
| 178 using_namespace_sandbox | 178 using_namespace_sandbox |
| 179 ? sandbox::NamespaceSandbox::LaunchProcess(cmd_line, options) | 179 ? sandbox::NamespaceSandbox::LaunchProcess(cmd_line, options) |
| 180 : base::LaunchProcess(cmd_line, options); | 180 : base::LaunchProcess(cmd_line, options); |
| 181 CHECK(process.IsValid()) << "Failed to launch zygote process"; | 181 CHECK(process.IsValid()) << "Failed to launch zygote process"; |
| 182 | 182 |
| 183 dummy_fd.reset(); | 183 dummy_fd.reset(); |
| 184 | 184 |
| 185 if (using_suid_sandbox) { | 185 if (using_suid_sandbox || using_namespace_sandbox) { |
| 186 // The SUID sandbox will execute the zygote in a new PID namespace, and | 186 // The SUID sandbox will execute the zygote in a new PID namespace, and |
| 187 // the main zygote process will then fork from there. Watch now our | 187 // the main zygote process will then fork from there. Watch now our |
| 188 // elaborate dance to find and validate the zygote's PID. | 188 // elaborate dance to find and validate the zygote's PID. |
| 189 | 189 |
| 190 // First we receive a message from the zygote boot process. | 190 // First we receive a message from the zygote boot process. |
| 191 base::ProcessId boot_pid; | 191 base::ProcessId boot_pid; |
| 192 CHECK(ReceiveFixedMessage( | 192 CHECK(ReceiveFixedMessage( |
| 193 fds[0], kZygoteBootMessage, sizeof(kZygoteBootMessage), &boot_pid)); | 193 fds[0], kZygoteBootMessage, sizeof(kZygoteBootMessage), &boot_pid)); |
| 194 | 194 |
| 195 // Within the PID namespace, the zygote boot process thinks it's PID 1, | 195 // Within the PID namespace, the zygote boot process thinks it's PID 1, |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 } | 590 } |
| 591 | 591 |
| 592 if (!sandbox::Credentials::CanCreateProcessInNewUserNS()) { | 592 if (!sandbox::Credentials::CanCreateProcessInNewUserNS()) { |
| 593 return false; | 593 return false; |
| 594 } | 594 } |
| 595 | 595 |
| 596 return true; | 596 return true; |
| 597 } | 597 } |
| 598 | 598 |
| 599 } // namespace content | 599 } // namespace content |
| OLD | NEW |