summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evgenii Stepanov <eugenis@google.com> 2020-06-03 18:50:47 -0700
committer Evgenii Stepanov <eugenis@google.com> 2020-06-04 14:30:43 -0700
commit5611fa78caf6aac69ab774f37d7eb921337019bb (patch)
tree1a453f2b8fa57af5bd186b9e42d65aee0399b5d1
parent77542c73be821af08a7a40cf7d462c4c266b076d (diff)
Clean MTE and GWP-ASan runtime flags after use.
A check in ZygoteHooks_nativePostForkChild expects runtime_flags to be empty. Clear the flags that have been used and are not needed any longer. Bug: 157939523 Test: adb logcat | grep "Unknown bits set in runtime_flags" Change-Id: Ifade5e2437cbf24ae1d3909032a98bd60fc8a148
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 3d8cae8e74d0..5c444bda1838 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -1744,6 +1744,8 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
}
android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &heap_tagging_level, sizeof(heap_tagging_level));
+ // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART runtime.
+ runtime_flags &= ~RuntimeFlags::MEMORY_TAG_LEVEL_MASK;
bool forceEnableGwpAsan = false;
switch (runtime_flags & RuntimeFlags::GWP_ASAN_LEVEL_MASK) {
@@ -1756,6 +1758,8 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
case RuntimeFlags::GWP_ASAN_LEVEL_LOTTERY:
android_mallopt(M_INITIALIZE_GWP_ASAN, &forceEnableGwpAsan, sizeof(forceEnableGwpAsan));
}
+ // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART runtime.
+ runtime_flags &= ~RuntimeFlags::GWP_ASAN_LEVEL_MASK;
if (NeedsNoRandomizeWorkaround()) {
// Work around ARM kernel ASLR lossage (http://b/5817320).