| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/nacl_host/nacl_process_host.h" | 7 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (!CreateChannel()) | 138 if (!CreateChannel()) |
| 139 return false; | 139 return false; |
| 140 | 140 |
| 141 CommandLine::StringType nacl_loader_prefix; | 141 CommandLine::StringType nacl_loader_prefix; |
| 142 #if defined(OS_POSIX) | 142 #if defined(OS_POSIX) |
| 143 nacl_loader_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 143 nacl_loader_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| 144 switches::kNaClLoaderCmdPrefix); | 144 switches::kNaClLoaderCmdPrefix); |
| 145 #endif // defined(OS_POSIX) | 145 #endif // defined(OS_POSIX) |
| 146 | 146 |
| 147 // Build command line for nacl. | 147 // Build command line for nacl. |
| 148 FilePath exe_path = GetChildPath(nacl_loader_prefix.empty()); | 148 |
| 149 #if defined(OS_MACOSX) |
| 150 // The Native Client process needs to be able to allocate a 1GB contiguous |
| 151 // region to use as the client environment's virtual address space. ASLR |
| 152 // (PIE) interferes with this by making it possible that no gap large enough |
| 153 // to accomodate this request will exist in the child process' address |
| 154 // space. Disable PIE for NaCl processes. See http://crbug.com/90221 and |
| 155 // http://code.google.com/p/nativeclient/issues/detail?id=2043. |
| 156 int flags = CHILD_NO_PIE; |
| 157 #elif defined(OS_LINUX) |
| 158 int flags = nacl_loader_prefix.empty() ? CHILD_ALLOW_SELF : CHILD_NORMAL; |
| 159 #else |
| 160 int flags = CHILD_NORMAL; |
| 161 #endif |
| 162 |
| 163 FilePath exe_path = GetChildPath(flags); |
| 149 if (exe_path.empty()) | 164 if (exe_path.empty()) |
| 150 return false; | 165 return false; |
| 151 | 166 |
| 152 CommandLine* cmd_line = new CommandLine(exe_path); | 167 CommandLine* cmd_line = new CommandLine(exe_path); |
| 153 nacl::CopyNaClCommandLineArguments(cmd_line); | 168 nacl::CopyNaClCommandLineArguments(cmd_line); |
| 154 | 169 |
| 155 cmd_line->AppendSwitchASCII(switches::kProcessType, | 170 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 156 switches::kNaClLoaderProcess); | 171 switches::kNaClLoaderProcess); |
| 157 | 172 |
| 158 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); | 173 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 383 } |
| 369 | 384 |
| 370 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { | 385 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 371 NOTREACHED() << "Invalid message with type = " << msg.type(); | 386 NOTREACHED() << "Invalid message with type = " << msg.type(); |
| 372 return false; | 387 return false; |
| 373 } | 388 } |
| 374 | 389 |
| 375 bool NaClProcessHost::CanShutdown() { | 390 bool NaClProcessHost::CanShutdown() { |
| 376 return true; | 391 return true; |
| 377 } | 392 } |
| OLD | NEW |