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

Side by Side Diff: components/nacl/loader/nacl_listener.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, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/nacl/loader/nacl_listener.h" 5 #include "components/nacl/loader/nacl_listener.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h>
8 #include <stdlib.h> 9 #include <stdlib.h>
9 10
10 #if defined(OS_POSIX) 11 #if defined(OS_POSIX)
11 #include <unistd.h> 12 #include <unistd.h>
12 #endif 13 #endif
13 14
14 #include "base/command_line.h" 15 #include "base/command_line.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
18 #include "base/rand_util.h" 19 #include "base/rand_util.h"
19 #include "components/nacl/common/nacl_messages.h" 20 #include "components/nacl/common/nacl_messages.h"
20 #include "components/nacl/loader/nacl_ipc_adapter.h" 21 #include "components/nacl/loader/nacl_ipc_adapter.h"
21 #include "components/nacl/loader/nacl_validation_db.h" 22 #include "components/nacl/loader/nacl_validation_db.h"
22 #include "components/nacl/loader/nacl_validation_query.h" 23 #include "components/nacl/loader/nacl_validation_query.h"
23 #include "ipc/ipc_channel_handle.h" 24 #include "ipc/ipc_channel_handle.h"
24 #include "ipc/ipc_switches.h" 25 #include "ipc/ipc_switches.h"
25 #include "ipc/ipc_sync_channel.h" 26 #include "ipc/ipc_sync_channel.h"
26 #include "ipc/ipc_sync_message_filter.h" 27 #include "ipc/ipc_sync_message_filter.h"
27 #include "native_client/src/public/chrome_main.h" 28 #include "native_client/src/public/chrome_main.h"
28 #include "native_client/src/public/nacl_app.h" 29 #include "native_client/src/public/nacl_app.h"
29 #include "native_client/src/public/nacl_file_info.h" 30 #include "native_client/src/public/nacl_file_info.h"
31 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
30 32
31 #if defined(OS_POSIX) 33 #if defined(OS_POSIX)
32 #include "base/file_descriptor_posix.h" 34 #include "base/file_descriptor_posix.h"
33 #endif 35 #endif
34 36
35 #if defined(OS_LINUX) 37 #if defined(OS_LINUX)
36 #include "components/nacl/loader/nonsfi/irt_random.h" 38 #include "components/nacl/loader/nonsfi/irt_random.h"
37 #include "components/nacl/loader/nonsfi/nonsfi_main.h" 39 #include "components/nacl/loader/nonsfi/nonsfi_main.h"
38 #include "content/public/common/child_process_sandbox_support_linux.h" 40 #include "content/public/common/child_process_sandbox_support_linux.h"
39 #include "native_client/src/trusted/desc/nacl_desc_io.h" 41 #include "native_client/src/trusted/desc/nacl_desc_io.h"
40 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
41 #include "ppapi/nacl_irt/plugin_startup.h" 42 #include "ppapi/nacl_irt/plugin_startup.h"
42 #endif 43 #endif
43 44
44 #if defined(OS_WIN) 45 #if defined(OS_WIN)
45 #include <fcntl.h> 46 #include <fcntl.h>
46 #include <io.h> 47 #include <io.h>
47 48
48 #include "content/public/common/sandbox_init.h" 49 #include "content/public/common/sandbox_init.h"
49 #endif 50 #endif
50 51
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 #if defined(OS_WIN) 384 #if defined(OS_WIN)
384 args->broker_duplicate_handle_func = BrokerDuplicateHandle; 385 args->broker_duplicate_handle_func = BrokerDuplicateHandle;
385 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; 386 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler;
386 args->debug_stub_server_port_selected_handler_func = 387 args->debug_stub_server_port_selected_handler_func =
387 DebugStubPortSelectedHandler; 388 DebugStubPortSelectedHandler;
388 #endif 389 #endif
389 #if defined(OS_LINUX) 390 #if defined(OS_LINUX)
390 args->prereserved_sandbox_size = prereserved_sandbox_size_; 391 args->prereserved_sandbox_size = prereserved_sandbox_size_;
391 #endif 392 #endif
392 393
394 NaClFileInfo nexe_file_info;
395 base::PlatformFile nexe_file = IPC::PlatformFileForTransitToPlatformFile(
396 params.nexe_file);
397 #if defined(OS_WIN)
398 nexe_file_info.desc =
399 _open_osfhandle(reinterpret_cast<intptr_t>(nexe_file),
400 _O_RDONLY | _O_BINARY);
401 #elif defined(OS_POSIX)
402 nexe_file_info.desc = nexe_file;
403 #else
404 #error Unsupported target platform.
405 #endif
406 nexe_file_info.file_token.lo = params.nexe_token_lo;
407 nexe_file_info.file_token.hi = params.nexe_token_hi;
408 args->nexe_desc = NaClDescIoFromFileInfo(nexe_file_info, NACL_ABI_O_RDONLY);
409
393 NaClChromeMainStartApp(nap, args); 410 NaClChromeMainStartApp(nap, args);
394 NOTREACHED(); 411 NOTREACHED();
395 } 412 }
396 413
397 void NaClListener::StartNonSfi(const nacl::NaClStartParams& params) { 414 void NaClListener::StartNonSfi(const nacl::NaClStartParams& params) {
398 #if !defined(OS_LINUX) 415 #if !defined(OS_LINUX)
399 NOTREACHED() << "Non-SFI NaCl is only supported on Linux"; 416 NOTREACHED() << "Non-SFI NaCl is only supported on Linux";
400 #else 417 #else
401 // Random number source initialization. 418 // Random number source initialization.
402 nacl::nonsfi::SetUrandomFd(base::GetUrandomFD()); 419 nacl::nonsfi::SetUrandomFd(base::GetUrandomFD());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 IPC::ChannelHandle trusted_renderer_handle = 506 IPC::ChannelHandle trusted_renderer_handle =
490 IPC::Channel::GenerateVerifiedChannelID("nacl"); 507 IPC::Channel::GenerateVerifiedChannelID("nacl");
491 trusted_listener_ = new NaClTrustedListener( 508 trusted_listener_ = new NaClTrustedListener(
492 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); 509 trusted_renderer_handle, io_thread_.message_loop_proxy().get());
493 #if defined(OS_POSIX) 510 #if defined(OS_POSIX)
494 trusted_renderer_handle.socket = base::FileDescriptor( 511 trusted_renderer_handle.socket = base::FileDescriptor(
495 trusted_listener_->TakeClientFileDescriptor(), true); 512 trusted_listener_->TakeClientFileDescriptor(), true);
496 #endif 513 #endif
497 return trusted_renderer_handle; 514 return trusted_renderer_handle;
498 } 515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698