OLD | NEW |
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 <fcntl.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" | 31 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
32 | 32 |
33 #if defined(OS_POSIX) | 33 #if defined(OS_POSIX) |
34 #include "base/file_descriptor_posix.h" | 34 #include "base/file_descriptor_posix.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) |
38 #include "components/nacl/loader/nonsfi/irt_random.h" | 38 #include "components/nacl/loader/nonsfi/irt_random.h" |
39 #include "components/nacl/loader/nonsfi/nonsfi_main.h" | 39 #include "components/nacl/loader/nonsfi/nonsfi_main.h" |
40 #include "content/public/common/child_process_sandbox_support_linux.h" | 40 #include "content/public/common/child_process_sandbox_support_linux.h" |
41 #include "native_client/src/trusted/desc/nacl_desc_io.h" | |
42 #include "ppapi/nacl_irt/plugin_startup.h" | 41 #include "ppapi/nacl_irt/plugin_startup.h" |
43 #endif | 42 #endif |
44 | 43 |
45 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
46 #include <fcntl.h> | 45 #include <fcntl.h> |
47 #include <io.h> | 46 #include <io.h> |
48 | 47 |
49 #include "content/public/common/sandbox_init.h" | 48 #include "content/public/common/sandbox_init.h" |
50 #endif | 49 #endif |
51 | 50 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 CHECK(!params.enable_debug_stub); | 484 CHECK(!params.enable_debug_stub); |
486 CHECK(params.debug_stub_server_bound_socket.fd == -1); | 485 CHECK(params.debug_stub_server_bound_socket.fd == -1); |
487 | 486 |
488 CHECK(!params.uses_irt); | 487 CHECK(!params.uses_irt); |
489 CHECK(params.handles.empty()); | 488 CHECK(params.handles.empty()); |
490 | 489 |
491 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); | 490 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); |
492 CHECK(params.nexe_token_lo == 0); | 491 CHECK(params.nexe_token_lo == 0); |
493 CHECK(params.nexe_token_hi == 0); | 492 CHECK(params.nexe_token_hi == 0); |
494 nacl::nonsfi::MainStart( | 493 nacl::nonsfi::MainStart( |
495 NaClDescIoDescFromDescAllocCtor( | 494 IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); |
496 IPC::PlatformFileForTransitToPlatformFile(params.nexe_file), | |
497 NACL_ABI_O_RDONLY)); | |
498 #endif // defined(OS_LINUX) | 495 #endif // defined(OS_LINUX) |
499 } | 496 } |
500 | 497 |
501 IPC::ChannelHandle NaClListener::CreateTrustedListener( | 498 IPC::ChannelHandle NaClListener::CreateTrustedListener( |
502 base::MessageLoopProxy* message_loop_proxy, | 499 base::MessageLoopProxy* message_loop_proxy, |
503 base::WaitableEvent* shutdown_event) { | 500 base::WaitableEvent* shutdown_event) { |
504 // The argument passed to GenerateVerifiedChannelID() here MUST be "nacl". | 501 // The argument passed to GenerateVerifiedChannelID() here MUST be "nacl". |
505 // Using an alternate channel name prevents the pipe from being created on | 502 // Using an alternate channel name prevents the pipe from being created on |
506 // Windows when the sandbox is enabled. | 503 // Windows when the sandbox is enabled. |
507 IPC::ChannelHandle trusted_renderer_handle = | 504 IPC::ChannelHandle trusted_renderer_handle = |
508 IPC::Channel::GenerateVerifiedChannelID("nacl"); | 505 IPC::Channel::GenerateVerifiedChannelID("nacl"); |
509 trusted_listener_ = new NaClTrustedListener( | 506 trusted_listener_ = new NaClTrustedListener( |
510 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); | 507 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); |
511 #if defined(OS_POSIX) | 508 #if defined(OS_POSIX) |
512 trusted_renderer_handle.socket = base::FileDescriptor( | 509 trusted_renderer_handle.socket = base::FileDescriptor( |
513 trusted_listener_->TakeClientFileDescriptor(), true); | 510 trusted_listener_->TakeClientFileDescriptor(), true); |
514 #endif | 511 #endif |
515 return trusted_renderer_handle; | 512 return trusted_renderer_handle; |
516 } | 513 } |
OLD | NEW |