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

Side by Side Diff: components/nacl/loader/nacl_helper_linux.cc

Issue 1053313002: Revert of Init Mojo embedder for Windows NaCl plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « components/nacl.gyp ('k') | components/nacl/loader/nacl_helper_win_64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // A mini-zygote specifically for Native Client. 5 // A mini-zygote specifically for Native Client.
6 6
7 #include "components/nacl/loader/nacl_helper_linux.h" 7 #include "components/nacl/loader/nacl_helper_linux.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 25 matching lines...) Expand all
36 #include "components/nacl/loader/nonsfi/nonsfi_listener.h" 36 #include "components/nacl/loader/nonsfi/nonsfi_listener.h"
37 #include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h" 37 #include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h"
38 #include "content/public/common/content_descriptors.h" 38 #include "content/public/common/content_descriptors.h"
39 #include "content/public/common/send_zygote_child_ping_linux.h" 39 #include "content/public/common/send_zygote_child_ping_linux.h"
40 #include "content/public/common/zygote_fork_delegate_linux.h" 40 #include "content/public/common/zygote_fork_delegate_linux.h"
41 #include "crypto/nss_util.h" 41 #include "crypto/nss_util.h"
42 #include "ipc/ipc_descriptors.h" 42 #include "ipc/ipc_descriptors.h"
43 #include "ipc/ipc_switches.h" 43 #include "ipc/ipc_switches.h"
44 #include "sandbox/linux/services/libc_urandom_override.h" 44 #include "sandbox/linux/services/libc_urandom_override.h"
45 45
46 #if !defined(OS_NACL_NONSFI)
47 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
48 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
49 #endif
50
51 #if defined(OS_NACL_NONSFI) 46 #if defined(OS_NACL_NONSFI)
52 #include "native_client/src/public/nonsfi/irt_exception_handling.h" 47 #include "native_client/src/public/nonsfi/irt_exception_handling.h"
53 #else 48 #else
54 #include <link.h> 49 #include <link.h>
55 #include "components/nacl/loader/nonsfi/irt_exception_handling.h" 50 #include "components/nacl/loader/nonsfi/irt_exception_handling.h"
56 #endif 51 #endif
57 52
58 namespace { 53 namespace {
59 54
60 struct NaClLoaderSystemInfo { 55 struct NaClLoaderSystemInfo {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // These are not used by nacl_helper_nonsfi. 450 // These are not used by nacl_helper_nonsfi.
456 CheckReservedAtZero(), 451 CheckReservedAtZero(),
457 sysconf(_SC_NPROCESSORS_ONLN) 452 sysconf(_SC_NPROCESSORS_ONLN)
458 #endif 453 #endif
459 }; 454 };
460 455
461 #if !defined(OS_NACL_NONSFI) 456 #if !defined(OS_NACL_NONSFI)
462 CheckRDebug(argv[0]); 457 CheckRDebug(argv[0]);
463 #endif 458 #endif
464 459
465 // TODO(teravest): Enable mojo for nonsfi. http://crbug.com/473418
466 #if !defined(OS_NACL_NONSFI)
467 mojo::embedder::Init(
468 make_scoped_ptr(new mojo::embedder::SimplePlatformSupport()));
469 #endif
470
471 scoped_ptr<nacl::NaClSandbox> nacl_sandbox(new nacl::NaClSandbox); 460 scoped_ptr<nacl::NaClSandbox> nacl_sandbox(new nacl::NaClSandbox);
472 // Make sure that the early initialization did not start any spurious 461 // Make sure that the early initialization did not start any spurious
473 // threads. 462 // threads.
474 #if !defined(THREAD_SANITIZER) 463 #if !defined(THREAD_SANITIZER)
475 CHECK(nacl_sandbox->IsSingleThreaded()); 464 CHECK(nacl_sandbox->IsSingleThreaded());
476 #endif 465 #endif
477 466
478 const bool is_init_process = 1 == getpid(); 467 const bool is_init_process = 1 == getpid();
479 nacl_sandbox->InitializeLayerOneSandbox(); 468 nacl_sandbox->InitializeLayerOneSandbox();
480 CHECK_EQ(is_init_process, nacl_sandbox->layer_one_enabled()); 469 CHECK_EQ(is_init_process, nacl_sandbox->layer_one_enabled());
481 470
482 const std::vector<int> empty; 471 const std::vector<int> empty;
483 // Send the zygote a message to let it know we are ready to help 472 // Send the zygote a message to let it know we are ready to help
484 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, 473 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor,
485 kNaClHelperStartupAck, 474 kNaClHelperStartupAck,
486 sizeof(kNaClHelperStartupAck), empty)) { 475 sizeof(kNaClHelperStartupAck), empty)) {
487 LOG(ERROR) << "*** send() to zygote failed"; 476 LOG(ERROR) << "*** send() to zygote failed";
488 } 477 }
489 478
490 // Now handle requests from the Zygote. 479 // Now handle requests from the Zygote.
491 while (true) { 480 while (true) {
492 bool request_handled = HandleZygoteRequest( 481 bool request_handled = HandleZygoteRequest(
493 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); 482 kNaClZygoteDescriptor, system_info, nacl_sandbox.get());
494 // Do not turn this into a CHECK() without thinking about robustness 483 // Do not turn this into a CHECK() without thinking about robustness
495 // against malicious IPC requests. 484 // against malicious IPC requests.
496 DCHECK(request_handled); 485 DCHECK(request_handled);
497 } 486 }
498 NOTREACHED(); 487 NOTREACHED();
499 } 488 }
OLDNEW
« no previous file with comments | « components/nacl.gyp ('k') | components/nacl/loader/nacl_helper_win_64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698