| Index: content/renderer/renderer_main_platform_delegate_android.cc
|
| diff --git a/content/renderer/renderer_main_platform_delegate_android.cc b/content/renderer/renderer_main_platform_delegate_android.cc
|
| index 4a19706360269bd76526fc348869c5c37775a198..0da47c3aca847a9dbd38b2293127f8f085a49e32 100644
|
| --- a/content/renderer/renderer_main_platform_delegate_android.cc
|
| +++ b/content/renderer/renderer_main_platform_delegate_android.cc
|
| @@ -3,7 +3,14 @@
|
| // found in the LICENSE file.
|
|
|
| #include "content/renderer/renderer_main_platform_delegate.h"
|
| +
|
| #include "base/logging.h"
|
| +#include "base/rand_util.h"
|
| +#include "base/sys_info.h"
|
| +#include "sandbox/linux/seccomp-bpf-helpers/baseline_policy_android.h"
|
| +#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
|
| +#include "third_party/skia/include/ports/SkFontConfigInterface.h"
|
| +#include "v8/include/v8.h"
|
|
|
| #ifdef ENABLE_VTUNE_JIT_INTERFACE
|
| #include "content/public/common/content_switches.h"
|
| @@ -12,6 +19,28 @@
|
|
|
| namespace content {
|
|
|
| +namespace {
|
| +
|
| +bool GenerateEntropy(unsigned char* buffer, size_t length) {
|
| + base::RandBytes(buffer, length);
|
| + return true;
|
| +}
|
| +
|
| +void PreSandboxWarmUp() {
|
| + base::RandUint64();
|
| +
|
| + base::SysInfo::AmountOfPhysicalMemory();
|
| + base::SysInfo::MaxSharedMemorySize();
|
| + base::SysInfo::NumberOfProcessors();
|
| +
|
| + v8::V8::SetEntropySource(&GenerateEntropy);
|
| + v8::V8::Initialize();
|
| +
|
| + SkFontConfigInterface::GetSingletonDirectInterface();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| RendererMainPlatformDelegate::RendererMainPlatformDelegate(
|
| const MainFunctionParams& parameters)
|
| : parameters_(parameters) {
|
| @@ -36,7 +65,15 @@ bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
|
| }
|
|
|
| bool RendererMainPlatformDelegate::EnableSandbox() {
|
| - return true;
|
| + PreSandboxWarmUp();
|
| +
|
| + sandbox::SandboxBPF sandbox;
|
| + sandbox.SetSandboxPolicy(new sandbox::BaselinePolicyAndroid);
|
| + sandbox.StartSandbox();
|
| + bool enabled = sandbox.SupportsSeccompSandbox(-1) ==
|
| + sandbox::SandboxBPF::STATUS_ENABLED;
|
| + CHECK(enabled);
|
| + return enabled;
|
| }
|
|
|
| void RendererMainPlatformDelegate::RunSandboxTests(bool no_sandbox) {
|
|
|