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

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

Issue 868253011: Make chrome.exe built with ASan/Win work with sandbox enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more EXPECT turned into ASSERT Created 5 years, 10 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 // 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_main_platform_delegate.h" 5 #include "components/nacl/loader/nacl_main_platform_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sandbox/win/src/sandbox.h" 8 #include "sandbox/win/src/sandbox.h"
9 9
10 NaClMainPlatformDelegate::NaClMainPlatformDelegate( 10 NaClMainPlatformDelegate::NaClMainPlatformDelegate(
11 const content::MainFunctionParams& parameters) 11 const content::MainFunctionParams& parameters)
12 : parameters_(parameters) { 12 : parameters_(parameters) {
13 } 13 }
14 14
15 NaClMainPlatformDelegate::~NaClMainPlatformDelegate() { 15 NaClMainPlatformDelegate::~NaClMainPlatformDelegate() {
16 } 16 }
17 17
18 void NaClMainPlatformDelegate::EnableSandbox() { 18 void NaClMainPlatformDelegate::EnableSandbox() {
19 sandbox::TargetServices* target_services = 19 sandbox::TargetServices* target_services =
20 parameters_.sandbox_info->target_services; 20 parameters_.sandbox_info->target_services;
21 21
22 CHECK(target_services) << "NaCl-Win EnableSandbox: No Target Services!"; 22 CHECK(target_services) << "NaCl-Win EnableSandbox: No Target Services!";
23 // Cause advapi32 to load before the sandbox is turned on. 23 // Cause advapi32 to load before the sandbox is turned on.
24 unsigned int dummy_rand; 24 unsigned int dummy_rand;
25 rand_s(&dummy_rand); 25 rand_s(&dummy_rand);
26 // Warm up language subsystems before the sandbox is turned on. 26 // Warm up language subsystems before the sandbox is turned on.
27 ::GetUserDefaultLangID(); 27 ::GetUserDefaultLangID();
28 ::GetUserDefaultLCID(); 28 ::GetUserDefaultLCID();
29
30 #if defined(ADDRESS_SANITIZER)
31 // Bind and leak dbghelp.dll before the token is lowered, otherwise
32 // AddressSanitizer will crash when trying to symbolize a report.
33 CHECK(LoadLibraryA("dbghelp.dll"));
34 #endif
35
29 // Turn the sandbox on. 36 // Turn the sandbox on.
30 target_services->LowerToken(); 37 target_services->LowerToken();
31 } 38 }
OLDNEW
« no previous file with comments | « no previous file | content/common/sandbox_init_win.cc » ('j') | sandbox/win/src/address_sanitizer_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698