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

Unified Diff: components/nacl/browser/nacl_process_host.cc

Issue 332463003: Pepper: Remove LOAD_MODULE SRPC call in SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for bbudge Created 6 years, 6 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
Index: components/nacl/browser/nacl_process_host.cc
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index e174e83a665533aab259dbdd71a4a7b6e701190e..32f19a4c1c48a1f8982f4573a5215968ea70b363 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -250,6 +250,8 @@ unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ =
NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
base::File nexe_file,
+ uint64_t nexe_token_lo,
+ uint64_t nexe_token_hi,
ppapi::PpapiPermissions permissions,
int render_view_id,
uint32 permission_bits,
@@ -262,6 +264,8 @@ NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
const base::FilePath& profile_directory)
: manifest_url_(manifest_url),
nexe_file_(nexe_file.Pass()),
+ nexe_token_lo_(nexe_token_lo),
+ nexe_token_hi_(nexe_token_hi),
permissions_(permissions),
#if defined(OS_WIN)
process_launched_by_broker_(false),
@@ -817,15 +821,30 @@ bool NaClProcessHost::StartNaClExecution() {
// Enable PPAPI proxy channel creation only for renderer processes.
params.enable_ipc_proxy = enable_ppapi_proxy();
+ // nexe_file_ still keeps the ownership at this moment, because |params|
+ // may just be destroyed before sending IPC is properly processed.
+ // Note that although we set auto_close=true for FileDescriptor's
+ // constructor, it is not automatically handled in its destructor as RAII.
+#if defined(OS_POSIX)
+ params.nexe_file =
+ base::FileDescriptor(nexe_file_.GetPlatformFile(), true);
+#elif defined(OS_WIN)
+ // Duplicate the handle from the renderer to the plugin process.
+ if (!::DuplicateHandle(nacl_host_message_filter_->PeerHandle(),
+ nexe_file_.GetPlatformFile(),
+ process_->GetData().handle,
+ &params.nexe_file,
+ 0, // Unused, given DUPLICATE_SAME_ACCESS.
+ FALSE,
+ DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS))
+ return false;
+#else
+#error Unsupported target platform.
+#endif
+
if (uses_nonsfi_mode_) {
// Currently, non-SFI mode is supported only on Linux.
#if defined(OS_LINUX)
- // nexe_file_ still keeps the ownership at this moment, because |params|
- // may just be destroyed before sending IPC is properly processed.
- // Note that although we set auto_close=true for FileDescriptor's
- // constructor, it is not automatically handled in its destructor as RAII.
- params.nexe_file =
- base::FileDescriptor(nexe_file_.GetPlatformFile(), true);
// In non-SFI mode, we do not use SRPC. Make sure that the socketpair is
// not created.
DCHECK_EQ(internal_->socket_for_sel_ldr, NACL_INVALID_HANDLE);
@@ -840,6 +859,9 @@ bool NaClProcessHost::StartNaClExecution() {
params.uses_irt = uses_irt_;
params.enable_dyncode_syscalls = enable_dyncode_syscalls_;
+ params.nexe_token_lo = nexe_token_lo_;
+ params.nexe_token_hi = nexe_token_hi_;
+
const ChildProcessData& data = process_->GetData();
if (!ShareHandleToSelLdr(data.handle,
internal_->socket_for_sel_ldr, true,
@@ -893,9 +915,9 @@ bool NaClProcessHost::StartNaClExecution() {
// Here we are about to send the IPC, so release file descriptors to delegate
// the ownership to the message.
- if (uses_nonsfi_mode_) {
- nexe_file_.TakePlatformFile();
- } else {
+ nexe_file_.TakePlatformFile();
+
+ if (!uses_nonsfi_mode_) {
internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
}

Powered by Google App Engine
This is Rietveld 408576698