Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 | 383 |
| 384 #if defined(OS_WIN) || defined(OS_MACOSX) | 384 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 385 // Open CDM host files before the process is sandboxed. | 385 // Open CDM host files before the process is sandboxed. |
| 386 if (!is_broker_ && IsCdm(path)) | 386 if (!is_broker_ && IsCdm(path)) |
| 387 cdm_host_files = CdmHostFiles::Create(path); | 387 cdm_host_files = CdmHostFiles::Create(path); |
| 388 #elif defined(OS_LINUX) | 388 #elif defined(OS_LINUX) |
| 389 cdm_host_files = CdmHostFiles::TakeGlobalInstance(); | 389 cdm_host_files = CdmHostFiles::TakeGlobalInstance(); |
| 390 if (is_broker_ || !IsCdm(path)) | 390 if (is_broker_ || !IsCdm(path)) |
| 391 cdm_host_files.reset(); // Close all opened files. | 391 cdm_host_files.reset(); // Close all opened files. |
| 392 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 392 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 393 | |
| 394 // Verify CDM host. On Windows and Mac, this is called unsandboxed. On Linux, | |
| 395 // this is called sandboxed. | |
| 396 if (cdm_host_files) { | |
| 397 DCHECK(IsCdm(path)); | |
| 398 if (!cdm_host_files->VerifyFiles(library.get(), path)) { | |
|
Will Harris
2017/05/01 20:59:00
what exactly does VerifyFiles do?
We agreed in th
xhwang
2017/05/01 23:05:45
As discussed offline, added links and updated func
| |
| 399 LOG(WARNING) << "CDM host verification failed."; | |
| 400 // TODO(xhwang): Add a new load result if needed. | |
| 401 ReportLoadResult(path, INIT_FAILED); | |
| 402 return; | |
| 403 } | |
| 404 } | |
| 393 #endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) | 405 #endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) |
| 394 | 406 |
| 395 #if defined(OS_WIN) | 407 #if defined(OS_WIN) |
| 396 // If code subsequently tries to exit using abort(), force a crash (since | 408 // If code subsequently tries to exit using abort(), force a crash (since |
| 397 // otherwise these would be silent terminations and fly under the radar). | 409 // otherwise these would be silent terminations and fly under the radar). |
| 398 base::win::SetAbortBehaviorForCrashReporting(); | 410 base::win::SetAbortBehaviorForCrashReporting(); |
| 399 | 411 |
| 400 // Once we lower the token the sandbox is locked down and no new modules | 412 // Once we lower the token the sandbox is locked down and no new modules |
| 401 // can be loaded. TODO(cpu): consider changing to the loading style of | 413 // can be loaded. TODO(cpu): consider changing to the loading style of |
| 402 // regular plugins. | 414 // regular plugins. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 #endif | 483 #endif |
| 472 | 484 |
| 473 int32_t init_error = plugin_entry_points_.initialize_module( | 485 int32_t init_error = plugin_entry_points_.initialize_module( |
| 474 local_pp_module_, | 486 local_pp_module_, |
| 475 &ppapi::proxy::PluginDispatcher::GetBrowserInterface); | 487 &ppapi::proxy::PluginDispatcher::GetBrowserInterface); |
| 476 if (init_error != PP_OK) { | 488 if (init_error != PP_OK) { |
| 477 LOG(WARNING) << "InitModule failed with error " << init_error; | 489 LOG(WARNING) << "InitModule failed with error " << init_error; |
| 478 ReportLoadResult(path, INIT_FAILED); | 490 ReportLoadResult(path, INIT_FAILED); |
| 479 return; | 491 return; |
| 480 } | 492 } |
| 481 #if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) | |
| 482 // Now the process is sandboxed. Verify CDM host. | |
| 483 if (cdm_host_files) { | |
| 484 DCHECK(IsCdm(path)); | |
| 485 if (!cdm_host_files->VerifyFiles(library.get(), path)) { | |
| 486 LOG(WARNING) << "CDM host verification failed."; | |
| 487 // TODO(xhwang): Add a new load result if needed. | |
| 488 ReportLoadResult(path, INIT_FAILED); | |
| 489 return; | |
| 490 } | |
| 491 } | |
| 492 #endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION) | |
| 493 } | 493 } |
| 494 | 494 |
| 495 // Initialization succeeded, so keep the plugin DLL loaded. | 495 // Initialization succeeded, so keep the plugin DLL loaded. |
| 496 library_.Reset(library.Release()); | 496 library_.Reset(library.Release()); |
| 497 | 497 |
| 498 ReportLoadResult(path, LOAD_SUCCESS); | 498 ReportLoadResult(path, LOAD_SUCCESS); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void PpapiThread::OnCreateChannel(base::ProcessId renderer_pid, | 501 void PpapiThread::OnCreateChannel(base::ProcessId renderer_pid, |
| 502 int renderer_child_id, | 502 int renderer_child_id, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 GetHistogramName(is_broker_, "LoadTime", path), | 637 GetHistogramName(is_broker_, "LoadTime", path), |
| 638 base::TimeDelta::FromMilliseconds(1), | 638 base::TimeDelta::FromMilliseconds(1), |
| 639 base::TimeDelta::FromSeconds(10), | 639 base::TimeDelta::FromSeconds(10), |
| 640 50, | 640 50, |
| 641 base::HistogramBase::kUmaTargetedHistogramFlag); | 641 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 642 | 642 |
| 643 histogram->AddTime(load_time); | 643 histogram->AddTime(load_time); |
| 644 } | 644 } |
| 645 | 645 |
| 646 } // namespace content | 646 } // namespace content |
| OLD | NEW |