summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mitch Phillips <mitchp@google.com> 2023-02-14 18:50:00 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-02-14 18:50:00 +0000
commit2fb37134a1f389b805fdedd066c5165949215e52 (patch)
tree1631f1cc8d6f6bdf24f965dc3b839613e156c8ea
parentd5f05902df02a258758afed6a03b99955fdae075 (diff)
parenta63fa9ad0908cd32cad8485d1bd5a1e2f9f4e247 (diff)
Merge "[GWP-ASan] Enable recoverable GWP-ASan for apps."
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 963a83e5d3ee..fad9e0e79899 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -1923,15 +1923,16 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
const char* nice_name_ptr = nice_name.has_value() ? nice_name.value().c_str() : nullptr;
android_mallopt_gwp_asan_options_t gwp_asan_options;
+ const char* kGwpAsanAppRecoverableSysprop =
+ "persist.device_config.memory_safety_native.gwp_asan_recoverable_apps";
// The system server doesn't have its nice name set by the time SpecializeCommon is called.
gwp_asan_options.program_name = nice_name_ptr ?: process_name;
switch (runtime_flags & RuntimeFlags::GWP_ASAN_LEVEL_MASK) {
default:
case RuntimeFlags::GWP_ASAN_LEVEL_DEFAULT:
- // TODO(b/247012630): Switch this to Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING once
- // performance and syshealth testing is completed, making the default for non-system
- // apps that don't specify a `gwpAsanMode` in their manifest to be sampled-recoverable.
- gwp_asan_options.desire = Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
+ gwp_asan_options.desire = GetBoolProperty(kGwpAsanAppRecoverableSysprop, true)
+ ? Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING
+ : Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
break;
case RuntimeFlags::GWP_ASAN_LEVEL_NEVER: