Merge "Don't ask libc for PT feature w/o kernel support."

This commit is contained in:
Mitch Phillips
2020-04-07 15:38:56 +00:00
committed by Android (Google) Code Review
4 changed files with 23 additions and 5 deletions

View File

@@ -1065,4 +1065,11 @@ public final class Zygote {
* Returns whether the hardware supports memory tagging (ARM MTE).
*/
public static native boolean nativeSupportsMemoryTagging();
/**
* Returns whether the kernel supports tagged pointers. Present in the
* Android Common Kernel from 4.14 and up. By default, you should prefer
* fully-feature Memory Tagging, rather than the static Tagged Pointers.
*/
public static native boolean nativeSupportsTaggedPointers();
}

View File

@@ -754,9 +754,9 @@ public class ZygoteInit {
/* The system server is more privileged than regular app processes, so it has async
* tag checks enabled on hardware that supports memory tagging. */
parsedArgs.mRuntimeFlags |= Zygote.MEMORY_TAG_LEVEL_ASYNC;
} else {
} else if (Zygote.nativeSupportsTaggedPointers()) {
/* Enable pointer tagging in the system server. Hardware support for this is present
* in all ARMv8 CPUs; this flag has no effect on other platforms. */
* in all ARMv8 CPUs. */
parsedArgs.mRuntimeFlags |= Zygote.MEMORY_TAG_LEVEL_TBI;
}