From 4581354e7a9ecf2acfbe9c507c5e5c0fc47fb087 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 9 Mar 2019 22:58:05 -0500 Subject: [PATCH] Allow zygote to execve Allow zygote to execute other programs (such as dex2oat). This fixes the bug that cause ART framework boot images failed to load and result to extremely serious performance degradation. Fix #1195 --- native/jni/magiskhide/proc_monitor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/native/jni/magiskhide/proc_monitor.cpp b/native/jni/magiskhide/proc_monitor.cpp index 0b36ba75e..51f90d04d 100644 --- a/native/jni/magiskhide/proc_monitor.cpp +++ b/native/jni/magiskhide/proc_monitor.cpp @@ -424,11 +424,13 @@ void proc_monitor() { if (attaches[pid] && check_pid(pid)) continue; break; + case PTRACE_EVENT_EXEC: case PTRACE_EVENT_EXIT: - PTRACE_LOG("exited with status: [%d]\n", msg); + PTRACE_LOG("exited or execve\n", msg); attaches[pid] = false; unknowns[pid] = false; - break; + xptrace(PTRACE_DETACH, pid); + continue; default: PTRACE_LOG("unknown event: %d\n", WEVENT(status)); break; @@ -438,7 +440,8 @@ void proc_monitor() { } else if (WSTOPSIG(status) == SIGSTOP) { if (attaches[pid]) { PTRACE_LOG("SIGSTOP from zygote child\n"); - xptrace(PTRACE_SETOPTIONS, pid, nullptr, PTRACE_O_TRACECLONE | PTRACE_O_TRACEEXIT); + xptrace(PTRACE_SETOPTIONS, pid, nullptr, + PTRACE_O_TRACECLONE | PTRACE_O_TRACEEXEC | PTRACE_O_TRACEEXIT); } else { PTRACE_LOG("SIGSTOP from unknown\n"); unknowns[pid] = true;