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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/service_runtime.cc

Issue 177113009: Support non-SFI mode in NaCl manifest file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime" 7 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime"
8 8
9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" 9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h"
10 10
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 NaClLog(4, "PluginReverseInterface::AddTempQuotaManagedFile: " 422 NaClLog(4, "PluginReverseInterface::AddTempQuotaManagedFile: "
423 "(file_id='%s')\n", file_id.c_str()); 423 "(file_id='%s')\n", file_id.c_str());
424 uint64_t file_key = STRTOULL(file_id.c_str(), NULL, 10); 424 uint64_t file_key = STRTOULL(file_id.c_str(), NULL, 10);
425 nacl::MutexLocker take(&mu_); 425 nacl::MutexLocker take(&mu_);
426 quota_files_.insert(file_key); 426 quota_files_.insert(file_key);
427 } 427 }
428 428
429 ServiceRuntime::ServiceRuntime(Plugin* plugin, 429 ServiceRuntime::ServiceRuntime(Plugin* plugin,
430 const Manifest* manifest, 430 const Manifest* manifest,
431 bool main_service_runtime, 431 bool main_service_runtime,
432 bool uses_nonsfi_mode,
432 pp::CompletionCallback init_done_cb, 433 pp::CompletionCallback init_done_cb,
433 pp::CompletionCallback crash_cb) 434 pp::CompletionCallback crash_cb)
434 : plugin_(plugin), 435 : plugin_(plugin),
435 main_service_runtime_(main_service_runtime), 436 main_service_runtime_(main_service_runtime),
437 uses_nonsfi_mode_(uses_nonsfi_mode),
436 reverse_service_(NULL), 438 reverse_service_(NULL),
437 anchor_(new nacl::WeakRefAnchor()), 439 anchor_(new nacl::WeakRefAnchor()),
438 rev_interface_(new PluginReverseInterface(anchor_, plugin, 440 rev_interface_(new PluginReverseInterface(anchor_, plugin,
439 manifest, 441 manifest,
440 this, 442 this,
441 init_done_cb, crash_cb)), 443 init_done_cb, crash_cb)),
442 exit_status_(-1), 444 exit_status_(-1),
443 start_sel_ldr_done_(false), 445 start_sel_ldr_done_(false),
444 callback_factory_(this) { 446 callback_factory_(this) {
445 NaClSrpcChannelInitialize(&command_channel_); 447 NaClSrpcChannelInitialize(&command_channel_);
(...skipping 17 matching lines...) Expand all
463 465
464 if (!subprocess_->LoadModule(&command_channel_, nacl_desc)) { 466 if (!subprocess_->LoadModule(&command_channel_, nacl_desc)) {
465 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, 467 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL,
466 "ServiceRuntime: load module failed"); 468 "ServiceRuntime: load module failed");
467 return false; 469 return false;
468 } 470 }
469 return true; 471 return true;
470 } 472 }
471 473
472 bool ServiceRuntime::InitReverseService(ErrorInfo* error_info) { 474 bool ServiceRuntime::InitReverseService(ErrorInfo* error_info) {
475 if (uses_nonsfi_mode_) {
476 // In non-SFI mode, open_resource() is not yet supported, so we do not
477 // need the reverse service. So, skip the initialization (with calling
478 // the completion callback).
479 // Note that there is on going work to replace SRPC by Chrome IPC (not only
480 // for non-SFI mode, but also for SFI mode) (crbug.com/333950),
481 // and non-SFI mode will use Chrome IPC for open_resource() after the
482 // refactoring is done.
483 rev_interface_->StartupInitializationComplete();
484 return true;
485 }
486
473 // Hook up the reverse service channel. We are the IMC client, but 487 // Hook up the reverse service channel. We are the IMC client, but
474 // provide SRPC service. 488 // provide SRPC service.
475 NaClDesc* out_conn_cap; 489 NaClDesc* out_conn_cap;
476 NaClSrpcResultCodes rpc_result = 490 NaClSrpcResultCodes rpc_result =
477 NaClSrpcInvokeBySignature(&command_channel_, 491 NaClSrpcInvokeBySignature(&command_channel_,
478 "reverse_setup::h", 492 "reverse_setup::h",
479 &out_conn_cap); 493 &out_conn_cap);
480 494
481 if (NACL_SRPC_RESULT_OK != rpc_result) { 495 if (NACL_SRPC_RESULT_OK != rpc_result) {
482 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP, 496 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP,
(...skipping 20 matching lines...) Expand all
503 return false; 517 return false;
504 } 518 }
505 return true; 519 return true;
506 } 520 }
507 521
508 bool ServiceRuntime::StartModule(ErrorInfo* error_info) { 522 bool ServiceRuntime::StartModule(ErrorInfo* error_info) {
509 // start the module. otherwise we cannot connect for multimedia 523 // start the module. otherwise we cannot connect for multimedia
510 // subsystem since that is handled by user-level code (not secure!) 524 // subsystem since that is handled by user-level code (not secure!)
511 // in libsrpc. 525 // in libsrpc.
512 int load_status = -1; 526 int load_status = -1;
513 NaClSrpcResultCodes rpc_result = 527 if (uses_nonsfi_mode_) {
514 NaClSrpcInvokeBySignature(&command_channel_, 528 // In non-SFI mode, we don't need to call start_module SRPC to launch
515 "start_module::i", 529 // the plugin.
516 &load_status); 530 load_status = LOAD_OK;
531 } else {
532 NaClSrpcResultCodes rpc_result =
533 NaClSrpcInvokeBySignature(&command_channel_,
534 "start_module::i",
535 &load_status);
517 536
518 if (NACL_SRPC_RESULT_OK != rpc_result) { 537 if (NACL_SRPC_RESULT_OK != rpc_result) {
519 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_START_MODULE, 538 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_START_MODULE,
520 "ServiceRuntime: could not start nacl module"); 539 "ServiceRuntime: could not start nacl module");
521 return false; 540 return false;
541 }
522 } 542 }
523 NaClLog(4, "ServiceRuntime::StartModule (load_status=%d)\n", 543
524 load_status); 544 NaClLog(4, "ServiceRuntime::StartModule (load_status=%d)\n", load_status);
525 if (main_service_runtime_) { 545 if (main_service_runtime_) {
526 plugin_->ReportSelLdrLoadStatus(load_status); 546 plugin_->ReportSelLdrLoadStatus(load_status);
527 } 547 }
528 if (LOAD_OK != load_status) { 548 if (LOAD_OK != load_status) {
529 error_info->SetReport( 549 error_info->SetReport(
530 PP_NACL_ERROR_SEL_LDR_START_STATUS, 550 PP_NACL_ERROR_SEL_LDR_START_STATUS,
531 NaClErrorString(static_cast<NaClErrorCode>(load_status))); 551 NaClErrorString(static_cast<NaClErrorCode>(load_status)));
532 return false; 552 return false;
533 } 553 }
534 return true; 554 return true;
(...skipping 18 matching lines...) Expand all
553 return; 573 return;
554 } 574 }
555 pp::CompletionCallback internal_callback = 575 pp::CompletionCallback internal_callback =
556 callback_factory_.NewCallback(&ServiceRuntime::StartSelLdrContinuation, 576 callback_factory_.NewCallback(&ServiceRuntime::StartSelLdrContinuation,
557 callback); 577 callback);
558 578
559 tmp_subprocess->Start(plugin_->pp_instance(), 579 tmp_subprocess->Start(plugin_->pp_instance(),
560 params.url.c_str(), 580 params.url.c_str(),
561 params.uses_irt, 581 params.uses_irt,
562 params.uses_ppapi, 582 params.uses_ppapi,
583 params.uses_nonsfi_mode,
563 params.enable_dev_interfaces, 584 params.enable_dev_interfaces,
564 params.enable_dyncode_syscalls, 585 params.enable_dyncode_syscalls,
565 params.enable_exception_handling, 586 params.enable_exception_handling,
566 params.enable_crash_throttling, 587 params.enable_crash_throttling,
567 &start_sel_ldr_error_message_, 588 &start_sel_ldr_error_message_,
568 internal_callback); 589 internal_callback);
569 subprocess_.reset(tmp_subprocess.release()); 590 subprocess_.reset(tmp_subprocess.release());
570 } 591 }
571 592
572 void ServiceRuntime::StartSelLdrContinuation(int32_t pp_error, 593 void ServiceRuntime::StartSelLdrContinuation(int32_t pp_error,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 738
718 nacl::string ServiceRuntime::GetCrashLogOutput() { 739 nacl::string ServiceRuntime::GetCrashLogOutput() {
719 if (NULL != subprocess_.get()) { 740 if (NULL != subprocess_.get()) {
720 return subprocess_->GetCrashLogOutput(); 741 return subprocess_->GetCrashLogOutput();
721 } else { 742 } else {
722 return std::string(); 743 return std::string();
723 } 744 }
724 } 745 }
725 746
726 } // namespace plugin 747 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698