Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 10039001: NaCl: Supply Windows handle-passing function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix + comment Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/nacl/nacl_listener.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | chrome/nacl/nacl_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698