blob: 268113816c2e5df2f3e10c8945aecedf0d3a841d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/nacl/loader/nacl_main_platform_delegate.h"
#include "base/logging.h"
#include "content/public/common/main_function_params.h"
#include "sandbox/win/src/sandbox.h"
void NaClMainPlatformDelegate::EnableSandbox(
const content::MainFunctionParams& parameters) {
sandbox::TargetServices* target_services =
parameters.sandbox_info->target_services;
CHECK(target_services) << "NaCl-Win EnableSandbox: No Target Services!";
// Cause advapi32 to load before the sandbox is turned on.
unsigned int dummy_rand;
rand_s(&dummy_rand);
// Warm up language subsystems before the sandbox is turned on.
::GetUserDefaultLangID();
::GetUserDefaultLCID();
#if defined(ADDRESS_SANITIZER)
// Bind and leak dbghelp.dll before the token is lowered, otherwise
// AddressSanitizer will crash when trying to symbolize a report.
CHECK(LoadLibraryA("dbghelp.dll"));
#endif
// Turn the sandbox on.
target_services->LowerToken();
}
|