Skip to content

Commit

Permalink
GWP-ASan: Enable by default on Windows/macOS
Browse files Browse the repository at this point in the history
Enable GWP-ASan for malloc and PartitionAlloc by default for Windows and
macOS and delete the former field trial config used to launch GWP-ASan.

Bug: 896019, 912286, 956824
Change-Id: Icd146bc63dd6e50e6c5319905ed2f761ebff1bb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866604
Auto-Submit: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Commit-Queue: Brian White <bcwhite@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Reviewed-by: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707356}
  • Loading branch information
vlad902 authored and Commit Bot committed Oct 18, 2019
1 parent 39b8978 commit 0a70d69
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
22 changes: 14 additions & 8 deletions components/gwp_asan/client/gwp_asan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ namespace gwp_asan {
namespace internal {
namespace {

constexpr int kDefaultMaxAllocations = 35;
constexpr int kDefaultMaxMetadata = 150;
constexpr int kDefaultMaxAllocations = 70;
constexpr int kDefaultMaxMetadata = 255;

#if defined(ARCH_CPU_64_BITS)
constexpr int kDefaultTotalPages = 2048;
Expand All @@ -51,17 +51,23 @@ constexpr int kDefaultTotalPages = kDefaultMaxMetadata * 2;
// multiplier * range**rand
// where rand is a random real number in the range [0,1).
constexpr int kDefaultAllocationSamplingMultiplier = 1000;
constexpr int kDefaultAllocationSamplingRange = 64;
constexpr int kDefaultAllocationSamplingRange = 16;

constexpr double kDefaultProcessSamplingProbability = 0.2;
constexpr double kDefaultProcessSamplingProbability = 0.015;
// The multiplier to increase the ProcessSamplingProbability in scenarios where
// we want to perform additional testing (e.g., on canary/dev builds).
constexpr int kDefaultProcessSamplingBoost2 = 5;
constexpr int kDefaultProcessSamplingBoost2 = 10;

const base::Feature kGwpAsanMalloc{"GwpAsanMalloc",
base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_WIN) || defined(OS_MACOSX)
constexpr base::FeatureState kDefaultEnabled = base::FEATURE_ENABLED_BY_DEFAULT;
#else
constexpr base::FeatureState kDefaultEnabled =
base::FEATURE_DISABLED_BY_DEFAULT;
#endif

const base::Feature kGwpAsanMalloc{"GwpAsanMalloc", kDefaultEnabled};
const base::Feature kGwpAsanPartitionAlloc{"GwpAsanPartitionAlloc",
base::FEATURE_DISABLED_BY_DEFAULT};
kDefaultEnabled};

// Returns whether this process should be sampled to enable GWP-ASan.
bool SampleProcess(const base::Feature& feature, bool boost_sampling) {
Expand Down
24 changes: 0 additions & 24 deletions testing/variations/fieldtrial_testing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2860,30 +2860,6 @@
]
}
],
"GwpAsanUnified": [
{
"platforms": [
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"params": {
"AllocationSamplingRange": "16",
"MaxAllocations": "70",
"MaxMetadata": "255",
"ProcessSamplingBoost2": "10",
"ProcessSamplingProbability": "0.015"
},
"enable_features": [
"GwpAsanMalloc",
"GwpAsanPartitionAlloc"
]
}
]
}
],
"HTTPReallyBadFinal": [
{
"platforms": [
Expand Down

0 comments on commit 0a70d69

Please sign in to comment.