2013-11-15 19:47:02 +01:00
|
|
|
// Copyright 2013 The Chromium Embedded Framework Authors. Portions Copyright
|
|
|
|
// 2011 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.
|
|
|
|
|
2022-04-21 20:58:48 +02:00
|
|
|
#include "base/notreached.h"
|
2022-10-17 19:27:40 +02:00
|
|
|
#include "sandbox/win/src/sandbox.h"
|
2013-11-15 19:47:02 +01:00
|
|
|
#include "sandbox/win/src/sandbox_factory.h"
|
|
|
|
|
2020-10-09 18:27:58 +02:00
|
|
|
#include "cef/libcef/features/features.h"
|
2017-05-31 17:33:30 +02:00
|
|
|
#include "include/cef_sandbox_win.h"
|
|
|
|
|
2013-11-15 19:47:02 +01:00
|
|
|
namespace {
|
|
|
|
|
2022-10-17 19:27:40 +02:00
|
|
|
// From content/app/sandbox_helper_win.cc:
|
2013-11-15 19:47:02 +01:00
|
|
|
void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) {
|
|
|
|
info->broker_services = sandbox::SandboxFactory::GetBrokerServices();
|
2022-10-17 19:27:40 +02:00
|
|
|
if (info->broker_services) {
|
2013-11-15 19:47:02 +01:00
|
|
|
// Ensure the proper mitigations are enforced for the browser process.
|
2022-10-17 19:27:40 +02:00
|
|
|
info->broker_services->RatchetDownSecurityMitigations(
|
2020-03-04 21:58:12 +01:00
|
|
|
sandbox::MITIGATION_DEP | sandbox::MITIGATION_DEP_NO_ATL_THUNK |
|
|
|
|
sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY);
|
|
|
|
// Note: these mitigations are "post-startup". Some mitigations that need
|
|
|
|
// to be enabled sooner (e.g. MITIGATION_EXTENSION_POINT_DISABLE) are done
|
|
|
|
// so in Chrome_ELF.
|
2022-10-17 19:27:40 +02:00
|
|
|
} else {
|
|
|
|
info->target_services = sandbox::SandboxFactory::GetTargetServices();
|
2013-11-15 19:47:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
void* cef_sandbox_info_create() {
|
|
|
|
sandbox::SandboxInterfaceInfo* info = new sandbox::SandboxInterfaceInfo();
|
|
|
|
memset(info, 0, sizeof(sandbox::SandboxInterfaceInfo));
|
|
|
|
InitializeSandboxInfo(info);
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cef_sandbox_info_destroy(void* sandbox_info) {
|
|
|
|
delete static_cast<sandbox::SandboxInterfaceInfo*>(sandbox_info);
|
|
|
|
}
|
2022-04-21 20:58:48 +02:00
|
|
|
|
|
|
|
#if BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
|
|
|
|
|
|
|
// Avoid bringing in partition_alloc dependencies.
|
|
|
|
namespace partition_alloc {
|
|
|
|
bool ReleaseReservation() {
|
|
|
|
NOTREACHED();
|
|
|
|
return false;
|
|
|
|
}
|
2022-06-23 10:20:39 +02:00
|
|
|
|
|
|
|
void TerminateBecauseOutOfMemory(size_t size) {
|
|
|
|
NOTREACHED();
|
|
|
|
}
|
2022-04-21 20:58:48 +02:00
|
|
|
} // namespace partition_alloc
|
|
|
|
|
|
|
|
#endif // BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|