diff options
author | Evgenii Stepanov <eugenis@google.com> | 2021-12-09 21:24:39 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-12-09 21:24:39 +0000 |
commit | 215b89a5c403f82b8665aad814e7aee347cb7a82 (patch) | |
tree | 4a4bdc0d5a76dc9482729ffe6a251c26405b2d64 | |
parent | 320e2a12de895e6085a06acb8ebdc5850540a3de (diff) | |
parent | 689bba18b38c63d74c35b5d7ea9592df650e9580 (diff) | |
download | base-215b89a5c403f82b8665aad814e7aee347cb7a82.tar.gz |
Merge changes Ibf64db88,I033ee79c am: 689bba18b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1915510
Change-Id: I5558464cf53cdbab4241706eb62c5fcc3a91afaf
-rw-r--r-- | services/core/java/com/android/server/am/ProcessList.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index f35afa5b7ca0..6c84ca4d9251 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -374,6 +374,16 @@ public final class ProcessList { private static final long NATIVE_HEAP_POINTER_TAGGING = 135754954; // This is a bug id. /** + * Native heap allocations in AppZygote process and its descendants will now have a + * non-zero tag in the most significant byte. + * @see <a href="https://source.android.com/devices/tech/debug/tagged-pointers">Tagged + * Pointers</a> + */ + @ChangeId + @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S) + private static final long NATIVE_HEAP_POINTER_TAGGING_APP_ZYGOTE = 207557677; + + /** * Enable asynchronous (ASYNC) memory tag checking in this process. This * flag will only have an effect on hardware supporting the ARM Memory * Tagging Extension (MTE). @@ -1738,6 +1748,16 @@ public final class ProcessList { return level; } + private int decideTaggingLevelForAppZygote(ProcessRecord app) { + int level = decideTaggingLevel(app); + // TBI ("fake" pointer tagging) in AppZygote is controlled by a separate compat feature. + if (!mPlatformCompat.isChangeEnabled(NATIVE_HEAP_POINTER_TAGGING_APP_ZYGOTE, app.info) + && level == Zygote.MEMORY_TAG_LEVEL_TBI) { + level = Zygote.MEMORY_TAG_LEVEL_NONE; + } + return level; + } + private int decideGwpAsanLevel(ProcessRecord app) { // Look at the process attribute first. if (app.processInfo != null @@ -2238,7 +2258,7 @@ public final class ProcessList { // not the calling one. appInfo.packageName = app.getHostingRecord().getDefiningPackageName(); appInfo.uid = uid; - int runtimeFlags = decideTaggingLevel(app); + int runtimeFlags = decideTaggingLevelForAppZygote(app); appZygote = new AppZygote(appInfo, uid, firstUid, lastUid, runtimeFlags); mAppZygotes.put(app.info.processName, uid, appZygote); zygoteProcessList = new ArrayList<ProcessRecord>(); |