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 <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "native_client/src/public/nacl_file_info.h" | 29 #include "native_client/src/public/nacl_file_info.h" |
30 | 30 |
31 #if defined(OS_POSIX) | 31 #if defined(OS_POSIX) |
32 #include "base/file_descriptor_posix.h" | 32 #include "base/file_descriptor_posix.h" |
33 #endif | 33 #endif |
34 | 34 |
35 #if defined(OS_LINUX) | 35 #if defined(OS_LINUX) |
36 #include "components/nacl/loader/nonsfi/irt_random.h" | 36 #include "components/nacl/loader/nonsfi/irt_random.h" |
37 #include "components/nacl/loader/nonsfi/nonsfi_main.h" | 37 #include "components/nacl/loader/nonsfi/nonsfi_main.h" |
38 #include "content/public/common/child_process_sandbox_support_linux.h" | 38 #include "content/public/common/child_process_sandbox_support_linux.h" |
| 39 #include "native_client/src/trusted/desc/nacl_desc_io.h" |
| 40 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" |
39 #include "ppapi/nacl_irt/plugin_startup.h" | 41 #include "ppapi/nacl_irt/plugin_startup.h" |
40 #endif | 42 #endif |
41 | 43 |
42 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
43 #include <fcntl.h> | 45 #include <fcntl.h> |
44 #include <io.h> | 46 #include <io.h> |
45 | 47 |
46 #include "content/public/common/sandbox_init.h" | 48 #include "content/public/common/sandbox_init.h" |
47 #endif | 49 #endif |
48 | 50 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // Ensure that the validation cache key (used as an extra input to the | 463 // Ensure that the validation cache key (used as an extra input to the |
462 // validation cache's hashing) isn't exposed accidentally. | 464 // validation cache's hashing) isn't exposed accidentally. |
463 CHECK(!params.validation_cache_enabled); | 465 CHECK(!params.validation_cache_enabled); |
464 CHECK(params.validation_cache_key.size() == 0); | 466 CHECK(params.validation_cache_key.size() == 0); |
465 CHECK(params.version.size() == 0); | 467 CHECK(params.version.size() == 0); |
466 // Ensure that a debug stub FD isn't passed through accidentally. | 468 // Ensure that a debug stub FD isn't passed through accidentally. |
467 CHECK(!params.enable_debug_stub); | 469 CHECK(!params.enable_debug_stub); |
468 CHECK(params.debug_stub_server_bound_socket.fd == -1); | 470 CHECK(params.debug_stub_server_bound_socket.fd == -1); |
469 | 471 |
470 CHECK(!params.uses_irt); | 472 CHECK(!params.uses_irt); |
| 473 // TODO(hidehiko): Currently imc bootstrap handle is still sent to the |
| 474 // plugin. Get rid of this. |
471 CHECK(params.handles.size() == 1); | 475 CHECK(params.handles.size() == 1); |
472 int imc_bootstrap_handle = nacl::ToNativeHandle(params.handles[0]); | 476 |
473 nacl::nonsfi::MainStart(imc_bootstrap_handle); | 477 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); |
| 478 nacl::nonsfi::MainStart( |
| 479 NaClDescIoDescFromDescAllocCtor( |
| 480 IPC::PlatformFileForTransitToPlatformFile(params.nexe_file), |
| 481 NACL_ABI_O_RDONLY)); |
474 #endif // defined(OS_LINUX) | 482 #endif // defined(OS_LINUX) |
475 } | 483 } |
476 | 484 |
477 IPC::ChannelHandle NaClListener::CreateTrustedListener( | 485 IPC::ChannelHandle NaClListener::CreateTrustedListener( |
478 base::MessageLoopProxy* message_loop_proxy, | 486 base::MessageLoopProxy* message_loop_proxy, |
479 base::WaitableEvent* shutdown_event) { | 487 base::WaitableEvent* shutdown_event) { |
480 // The argument passed to GenerateVerifiedChannelID() here MUST be "nacl". | 488 // The argument passed to GenerateVerifiedChannelID() here MUST be "nacl". |
481 // Using an alternate channel name prevents the pipe from being created on | 489 // Using an alternate channel name prevents the pipe from being created on |
482 // Windows when the sandbox is enabled. | 490 // Windows when the sandbox is enabled. |
483 IPC::ChannelHandle trusted_renderer_handle = | 491 IPC::ChannelHandle trusted_renderer_handle = |
484 IPC::Channel::GenerateVerifiedChannelID("nacl"); | 492 IPC::Channel::GenerateVerifiedChannelID("nacl"); |
485 trusted_listener_ = new NaClTrustedListener( | 493 trusted_listener_ = new NaClTrustedListener( |
486 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); | 494 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); |
487 #if defined(OS_POSIX) | 495 #if defined(OS_POSIX) |
488 trusted_renderer_handle.socket = base::FileDescriptor( | 496 trusted_renderer_handle.socket = base::FileDescriptor( |
489 trusted_listener_->TakeClientFileDescriptor(), true); | 497 trusted_listener_->TakeClientFileDescriptor(), true); |
490 #endif | 498 #endif |
491 return trusted_renderer_handle; | 499 return trusted_renderer_handle; |
492 } | 500 } |
OLD | NEW |