| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // A mini-zygote specifically for Native Client. | 5 // A mini-zygote specifically for Native Client. |
| 6 | 6 |
| 7 #include "components/nacl/loader/nacl_helper_linux.h" | 7 #include "components/nacl/loader/nacl_helper_linux.h" |
| 8 | 8 |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 const std::string& channel_id) { | 145 const std::string& channel_id) { |
| 146 DCHECK(child_fds.size() > | 146 DCHECK(child_fds.size() > |
| 147 std::max(content::ZygoteForkDelegate::kPIDOracleFDIndex, | 147 std::max(content::ZygoteForkDelegate::kPIDOracleFDIndex, |
| 148 content::ZygoteForkDelegate::kBrowserFDIndex)); | 148 content::ZygoteForkDelegate::kBrowserFDIndex)); |
| 149 | 149 |
| 150 // Ping the PID oracle socket. | 150 // Ping the PID oracle socket. |
| 151 CHECK(content::SendZygoteChildPing( | 151 CHECK(content::SendZygoteChildPing( |
| 152 child_fds[content::ZygoteForkDelegate::kPIDOracleFDIndex].get())); | 152 child_fds[content::ZygoteForkDelegate::kPIDOracleFDIndex].get())); |
| 153 | 153 |
| 154 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 154 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 155 switches::kMojoChannelToken, channel_id); | 155 switches::kServiceRequestChannelToken, channel_id); |
| 156 | 156 |
| 157 // Save the browser socket and close the rest. | 157 // Save the browser socket and close the rest. |
| 158 base::ScopedFD browser_fd( | 158 base::ScopedFD browser_fd( |
| 159 std::move(child_fds[content::ZygoteForkDelegate::kBrowserFDIndex])); | 159 std::move(child_fds[content::ZygoteForkDelegate::kBrowserFDIndex])); |
| 160 child_fds.clear(); | 160 child_fds.clear(); |
| 161 | 161 |
| 162 BecomeNaClLoader(std::move(browser_fd), system_info, uses_nonsfi_mode, | 162 BecomeNaClLoader(std::move(browser_fd), system_info, uses_nonsfi_mode, |
| 163 nacl_sandbox); | 163 nacl_sandbox); |
| 164 _exit(1); | 164 _exit(1); |
| 165 } | 165 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Now handle requests from the Zygote. | 467 // Now handle requests from the Zygote. |
| 468 while (true) { | 468 while (true) { |
| 469 bool request_handled = HandleZygoteRequest( | 469 bool request_handled = HandleZygoteRequest( |
| 470 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); | 470 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); |
| 471 // Do not turn this into a CHECK() without thinking about robustness | 471 // Do not turn this into a CHECK() without thinking about robustness |
| 472 // against malicious IPC requests. | 472 // against malicious IPC requests. |
| 473 DCHECK(request_handled); | 473 DCHECK(request_handled); |
| 474 } | 474 } |
| 475 NOTREACHED(); | 475 NOTREACHED(); |
| 476 } | 476 } |
| OLD | NEW |