Merge "Enable ptrace on userdebug when JDWP is disabled" into main am: e59b750030
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2650574 Change-Id: Ie355bc8eab34f33dada114891eda5a71be817c21 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -195,6 +195,11 @@ public final class Zygote {
|
|||||||
*/
|
*/
|
||||||
public static final int PROFILEABLE = 1 << 24;
|
public static final int PROFILEABLE = 1 << 24;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable ptrace. This is enabled on eng or userdebug builds, or if the app is debuggable.
|
||||||
|
*/
|
||||||
|
public static final int DEBUG_ENABLE_PTRACE = 1 << 25;
|
||||||
|
|
||||||
/** No external storage should be mounted. */
|
/** No external storage should be mounted. */
|
||||||
public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE;
|
public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE;
|
||||||
/** Default external storage should be mounted. */
|
/** Default external storage should be mounted. */
|
||||||
@@ -1028,6 +1033,9 @@ public final class Zygote {
|
|||||||
if (Build.IS_ENG || ENABLE_JDWP) {
|
if (Build.IS_ENG || ENABLE_JDWP) {
|
||||||
args.mRuntimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
args.mRuntimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
||||||
}
|
}
|
||||||
|
if (RoSystemProperties.DEBUGGABLE) {
|
||||||
|
args.mRuntimeFlags |= Zygote.DEBUG_ENABLE_PTRACE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ enum RuntimeFlags : uint32_t {
|
|||||||
GWP_ASAN_LEVEL_DEFAULT = 3 << 21,
|
GWP_ASAN_LEVEL_DEFAULT = 3 << 21,
|
||||||
NATIVE_HEAP_ZERO_INIT_ENABLED = 1 << 23,
|
NATIVE_HEAP_ZERO_INIT_ENABLED = 1 << 23,
|
||||||
PROFILEABLE = 1 << 24,
|
PROFILEABLE = 1 << 24,
|
||||||
|
DEBUG_ENABLE_PTRACE = 1 << 25,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum UnsolicitedZygoteMessageTypes : uint32_t {
|
enum UnsolicitedZygoteMessageTypes : uint32_t {
|
||||||
@@ -1887,8 +1888,10 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set process properties to enable debugging if required.
|
// Set process properties to enable debugging if required.
|
||||||
if ((runtime_flags & RuntimeFlags::DEBUG_ENABLE_JDWP) != 0) {
|
if ((runtime_flags & RuntimeFlags::DEBUG_ENABLE_PTRACE) != 0) {
|
||||||
EnableDebugger();
|
EnableDebugger();
|
||||||
|
// Don't pass unknown flag to the ART runtime.
|
||||||
|
runtime_flags &= ~RuntimeFlags::DEBUG_ENABLE_PTRACE;
|
||||||
}
|
}
|
||||||
if ((runtime_flags & RuntimeFlags::PROFILE_FROM_SHELL) != 0) {
|
if ((runtime_flags & RuntimeFlags::PROFILE_FROM_SHELL) != 0) {
|
||||||
// simpleperf needs the process to be dumpable to profile it.
|
// simpleperf needs the process to be dumpable to profile it.
|
||||||
|
|||||||
@@ -1741,6 +1741,7 @@ public final class ProcessList {
|
|||||||
|
|
||||||
if (debuggableFlag) {
|
if (debuggableFlag) {
|
||||||
runtimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
runtimeFlags |= Zygote.DEBUG_ENABLE_JDWP;
|
||||||
|
runtimeFlags |= Zygote.DEBUG_ENABLE_PTRACE;
|
||||||
runtimeFlags |= Zygote.DEBUG_JAVA_DEBUGGABLE;
|
runtimeFlags |= Zygote.DEBUG_JAVA_DEBUGGABLE;
|
||||||
// Also turn on CheckJNI for debuggable apps. It's quite
|
// Also turn on CheckJNI for debuggable apps. It's quite
|
||||||
// awkward to turn on otherwise.
|
// awkward to turn on otherwise.
|
||||||
|
|||||||
Reference in New Issue
Block a user