Index: chrome/browser/nacl_host/nacl_process_host.cc |
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc |
index 4bf5b4078895a184b809d9f01fdbf4a64c9517bc..a804c8cf894b4b574ca15b4a2d3ffe87af71be50 100644 |
--- a/chrome/browser/nacl_host/nacl_process_host.cc |
+++ b/chrome/browser/nacl_host/nacl_process_host.cc |
@@ -50,6 +50,7 @@ |
#include "base/threading/thread.h" |
#include "base/process_util.h" |
#include "chrome/browser/nacl_host/nacl_broker_service_win.h" |
+#include "content/public/common/sandbox_init.h" |
#include "native_client/src/trusted/service_runtime/win/debug_exception_handler.h" |
#endif |
@@ -918,6 +919,9 @@ bool NaClProcessHost::SendStart() { |
const ChildProcessData& data = process_->GetData(); |
#if defined(OS_WIN) |
// Copy the process handle into the renderer process. |
+ // TODO(mseaborn): Remove this. The renderer process uses this |
+ // handle with NaCl's handle_pass module, but we are replacing |
+ // handle_pass with Chrome's BrokerDuplicateHandle() function. |
if (!DuplicateHandle(base::GetCurrentProcessHandle(), |
data.handle, |
chrome_render_message_filter_->peer_handle(), |
@@ -928,6 +932,17 @@ bool NaClProcessHost::SendStart() { |
DLOG(ERROR) << "DuplicateHandle() failed"; |
return false; |
} |
+ // If we are on 64-bit Windows, the NaCl process's sandbox is |
+ // managed by a different process from the renderer's sandbox. We |
+ // need to inform the renderer's sandbox about the NaCl process so |
+ // that the renderer can send handles to the NaCl process using |
+ // BrokerDuplicateHandle(). |
+ if (RunningOnWOW64()) { |
+ if (!content::BrokerAddTargetPeer(data.handle)) { |
+ DLOG(ERROR) << "Failed to add NaCl process PID"; |
+ return false; |
+ } |
+ } |
#else |
// We use pid as process handle on Posix |
nacl_process_handle = data.handle; |