summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mitch Phillips <mitchp@google.com> 2023-02-14 19:47:13 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-02-14 19:47:13 +0000
commit2b0e39ad94e850e41009c709f94e71529b7acb33 (patch)
tree13aaf7017a5b2895bcf0ef869dea265c76541b4b
parentecfa9eca420950ae7c20427ee78f54a07ab664a2 (diff)
parentd2fc8c60970ef8c3392bae1b3be2a2db354aab57 (diff)
Merge "[GWP-ASan] Enable recoverable GWP-ASan for apps." am: 2fb37134a1 am: d2fc8c6097
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2428075 Change-Id: Id50fee0cb2b34e521b30bf942e3f7be04dd51742 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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 81b3f343d088..f04e2457d51f 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -1929,15 +1929,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: