From dad20f6a2d51f6d959304f3f027b7ddc1cdd3724 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 25 May 2019 18:30:43 -0700 Subject: [PATCH] Update zygote namespace Close #1492 --- native/jni/magiskhide/proc_monitor.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/native/jni/magiskhide/proc_monitor.cpp b/native/jni/magiskhide/proc_monitor.cpp index fe1b89304..cf1163080 100644 --- a/native/jni/magiskhide/proc_monitor.cpp +++ b/native/jni/magiskhide/proc_monitor.cpp @@ -362,14 +362,18 @@ static bool check_pid(int pid) { } static void new_zygote(int pid) { - if (zygote_map.count(pid)) - return; - - LOGD("proc_monitor: ptrace zygote PID=[%d]\n", pid); - struct stat st; if (read_ns(pid, &st)) return; + + auto it = zygote_map.find(pid); + if (it != zygote_map.end()) { + // Update namespace info + it->second = st; + return; + } + + LOGD("proc_monitor: ptrace zygote PID=[%d]\n", pid); zygote_map[pid] = st; xptrace(PTRACE_ATTACH, pid);