diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 00:47:50 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 00:47:50 +0000 |
commit | e4f6eb02319b57de1c2f0d0c23cde72a486e2bfd (patch) | |
tree | 5794afb3d0b0f103fe75f0e243da2a509fc876a4 /chrome/browser/nacl_host | |
parent | dc976477a26ef1b7e1cd4ae455812c05759c8468 (diff) | |
download | chromium_src-e4f6eb02319b57de1c2f0d0c23cde72a486e2bfd.zip chromium_src-e4f6eb02319b57de1c2f0d0c23cde72a486e2bfd.tar.gz chromium_src-e4f6eb02319b57de1c2f0d0c23cde72a486e2bfd.tar.bz2 |
Supply Windows handle-passing function to NaCl
Pass BrokerDuplicateHandle() to the NaCl loader process in
nacl_listener.cc.
Pass BrokerDuplicateHandle() to the NaCl trusted plugin. We need to
add this to PPB_NaCl_Private in order to pass it through.
Remove the use of the "init_handle_passing" SRPC call. Otherwise the
NaCl process will attempt to do an imc_connect() to the renderer,
which involves sending a handle to it, which fails.
Add a wrapper for AddTargetPeer() to 'content' so that
nacl_process_host.cc can use it.
Change the renderer's handle-passing policy to allow sending handles
other than Sections. The NaCl trusted plugin sends other handle types
to the NaCl loader process.
This change will allow the sandbox to be tightened up, in the future,
so that the NaCl loader process and the renderer process do not have
handles to each other.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=2719
TEST=nacl_integration etc.
Review URL: https://chromiumcodereview.appspot.com/10039001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/nacl_host')
-rw-r--r-- | chrome/browser/nacl_host/nacl_process_host.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 4bf5b40..a804c8c 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; |