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

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 191533002: Preload amdhcp64.dll or amdhcp32.dll before sandbox lockdown. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/cpu.h"
10 #include "base/debug/crash_logging.h" 11 #include "base/debug/crash_logging.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/rand_util.h" 14 #include "base/rand_util.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "content/child/browser_font_resource_trusted.h" 19 #include "content/child/browser_font_resource_trusted.h"
19 #include "content/child/child_process.h" 20 #include "content/child/child_process.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 282
282 #if defined(OS_WIN) 283 #if defined(OS_WIN)
283 // If code subsequently tries to exit using abort(), force a crash (since 284 // If code subsequently tries to exit using abort(), force a crash (since
284 // otherwise these would be silent terminations and fly under the radar). 285 // otherwise these would be silent terminations and fly under the radar).
285 base::win::SetAbortBehaviorForCrashReporting(); 286 base::win::SetAbortBehaviorForCrashReporting();
286 287
287 // Once we lower the token the sandbox is locked down and no new modules 288 // Once we lower the token the sandbox is locked down and no new modules
288 // can be loaded. TODO(cpu): consider changing to the loading style of 289 // can be loaded. TODO(cpu): consider changing to the loading style of
289 // regular plugins. 290 // regular plugins.
290 if (g_target_services) { 291 if (g_target_services) {
291 // Let Flash load DRM before lockdown on Vista+. 292 // Let Flash load DXVA before lockdown on Vista+.
292 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) && 293 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) {
293 base::win::OSInfo::GetInstance()->version() >= 294 if (base::win::OSInfo::GetInstance()->version() >=
294 base::win::VERSION_VISTA ) { 295 base::win::VERSION_VISTA) {
295 LoadLibrary(L"dxva2.dll"); 296 LoadLibraryA("dxva2.dll");
297 }
298
299 if (base::win::OSInfo::GetInstance()->version() >=
300 base::win::VERSION_WIN7) {
301 base::CPU cpu;
302 if ((cpu.vendor_name() == "AuthenticAMD") && (cpu.family() > 0x14)) {
303 // The AMD crypto acceleration is only AMD Bulldozer and above.
304 #if defined(_WIN64)
305 LoadLibraryA("amdhcp64.dll");
306 #else
307 LoadLibraryA("amdhcp32.dll");
308 #endif
309 }
310 }
296 } 311 }
297 312
298 // Cause advapi32 to load before the sandbox is turned on. 313 // Cause advapi32 to load before the sandbox is turned on.
299 unsigned int dummy_rand; 314 unsigned int dummy_rand;
300 rand_s(&dummy_rand); 315 rand_s(&dummy_rand);
301 // Warm up language subsystems before the sandbox is turned on. 316 // Warm up language subsystems before the sandbox is turned on.
302 ::GetUserDefaultLangID(); 317 ::GetUserDefaultLangID();
303 ::GetUserDefaultLCID(); 318 ::GetUserDefaultLCID();
304 319
305 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) { 320 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) {
306 // Warm up system locales. 321 // Warm up system locales.
307 EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED); 322 EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED);
308 } 323 }
309 324 // Engage the sandbox.
310 g_target_services->LowerToken(); 325 g_target_services->LowerToken();
311 } 326 }
312 #endif 327 #endif
313 328
314 if (is_broker_) { 329 if (is_broker_) {
315 // Get the InitializeBroker function (required). 330 // Get the InitializeBroker function (required).
316 InitializeBrokerFunc init_broker = 331 InitializeBrokerFunc init_broker =
317 reinterpret_cast<InitializeBrokerFunc>( 332 reinterpret_cast<InitializeBrokerFunc>(
318 library.GetFunctionPointer("PPP_InitializeBroker")); 333 library.GetFunctionPointer("PPP_InitializeBroker"));
319 if (!init_broker) { 334 if (!init_broker) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 histogram_name.str(), 490 histogram_name.str(),
476 1, 491 1,
477 LOAD_RESULT_MAX, 492 LOAD_RESULT_MAX,
478 LOAD_RESULT_MAX + 1, 493 LOAD_RESULT_MAX + 1,
479 base::HistogramBase::kUmaTargetedHistogramFlag); 494 base::HistogramBase::kUmaTargetedHistogramFlag);
480 495
481 histogram->Add(result); 496 histogram->Add(result);
482 } 497 }
483 498
484 } // namespace content 499 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698