Commit 3f767cdd authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Commit Bot

Disable GigaCage if windows version < Win8.1.

Bug: 1086388, 1101421

Change-Id: I3b4bcb7f9df934963cff68609bd9960f1e1249ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2348738
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800042}
parent bc34f320
...@@ -11,6 +11,13 @@ ...@@ -11,6 +11,13 @@
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_WIN)
// VersionHelpers.h depends on Windows.h.
#include <Windows.h>
// For IsWindows8Point1OrGreater().
#include <VersionHelpers.h>
#endif
namespace base { namespace base {
struct Feature; struct Feature;
...@@ -27,8 +34,19 @@ ALWAYS_INLINE bool IsPartitionAllocGigaCageEnabled() { ...@@ -27,8 +34,19 @@ ALWAYS_INLINE bool IsPartitionAllocGigaCageEnabled() {
#if !(defined(ARCH_CPU_64_BITS) && !defined(OS_NACL)) #if !(defined(ARCH_CPU_64_BITS) && !defined(OS_NACL))
return false; return false;
#elif BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) #elif BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
// We have to check if windows version is greater than or equal to 8.1.
// If IsWindows8Point1OrGreater() doesn't allocate any memory,
// we will use the helper function here. See https://crbug.com/1101421.
return true; return true;
#else #else // defined(ARCH_CPU_64_BITS) && !defined(OS_NACL)
#if defined(OS_WIN)
// Lots of crashes (at PartitionAddressSpace::Init) occur
// when enabling GigaCage on Windows whose version is smaller than 8.1,
// because PTEs for reserved memory counts against commit limit. See
// https://crbug.com/1101421.
if (!IsWindows8Point1OrGreater())
return false;
#endif
return FeatureList::IsEnabled(kPartitionAllocGigaCage); return FeatureList::IsEnabled(kPartitionAllocGigaCage);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment