[GWP-ASan] Remove system_default torture tests.
While these tests were running, other native processes would get torture GWP-ASan. This can lead to OOMs.
Bug: 273904016
Change-Id: Ia813a73bfc1c379633be022dbf4b7d567069c731
Test: atest bionic-unit-tests (in presubmit)
diff --git a/tests/gwp_asan_test.cpp b/tests/gwp_asan_test.cpp
index 8b12bec..c31f48c 100644
--- a/tests/gwp_asan_test.cpp
+++ b/tests/gwp_asan_test.cpp
@@ -143,6 +143,16 @@
EXPECT_DEATH({ *x = 7; }, "");
}
+// A weaker version of the above tests, only checking that GWP-ASan is enabled
+// for any pointer, not *our* pointer. This allows us to test the system_default
+// sysprops without potentially OOM-ing other random processes:
+// b/273904016#comment5
+TEST(gwp_asan_integration, DISABLED_assert_gwp_asan_enabled_weaker) {
+ std::string maps;
+ EXPECT_TRUE(android::base::ReadFileToString("/proc/self/maps", &maps));
+ EXPECT_TRUE(maps.find("GWP-ASan") != std::string::npos) << maps;
+}
+
TEST(gwp_asan_integration, DISABLED_assert_gwp_asan_disabled) {
std::string maps;
EXPECT_TRUE(android::base::ReadFileToString("/proc/self/maps", &maps));
@@ -184,32 +194,6 @@
RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
}
-TEST(gwp_asan_integration, sysprops_system) {
- // Do not override HWASan with GWP ASan.
- SKIP_WITH_HWASAN;
-
- SyspropRestorer restorer;
-
- __system_property_set("libc.debug.gwp_asan.sample_rate.system_default", "1");
- __system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "1");
- __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "40000");
-
- RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
-}
-
-TEST(gwp_asan_integration, sysprops_persist_system) {
- // Do not override HWASan with GWP ASan.
- SKIP_WITH_HWASAN;
-
- SyspropRestorer restorer;
-
- __system_property_set("persist.libc.debug.gwp_asan.sample_rate.system_default", "1");
- __system_property_set("persist.libc.debug.gwp_asan.process_sampling.system_default", "1");
- __system_property_set("persist.libc.debug.gwp_asan.max_allocs.system_default", "40000");
-
- RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
-}
-
TEST(gwp_asan_integration, sysprops_non_persist_overrides_persist) {
// Do not override HWASan with GWP ASan.
SKIP_WITH_HWASAN;
@@ -218,13 +202,18 @@
__system_property_set("libc.debug.gwp_asan.sample_rate.system_default", "1");
__system_property_set("libc.debug.gwp_asan.process_sampling.system_default", "1");
- __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "40000");
+ // Note, any processes launched elsewhere on the system right now will have
+ // GWP-ASan enabled. Make sure that we only use a single slot, otherwise we
+ // could end up causing said badly-timed processes to use up to 163MiB extra
+ // penalty that 40,000 allocs would cause. See b/273904016#comment5 for more
+ // context.
+ __system_property_set("libc.debug.gwp_asan.max_allocs.system_default", "1");
__system_property_set("persist.libc.debug.gwp_asan.sample_rate.system_default", "0");
__system_property_set("persist.libc.debug.gwp_asan.process_sampling.system_default", "0");
__system_property_set("persist.libc.debug.gwp_asan.max_allocs.system_default", "0");
- RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled");
+ RunSubtestNoEnv("gwp_asan_integration.DISABLED_assert_gwp_asan_enabled_weaker");
}
TEST(gwp_asan_integration, sysprops_program_specific_overrides_default) {