From f642fb3b99400f33ff1b77ada07ab9692e42833e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 24 Sep 2021 01:23:58 -0700 Subject: [PATCH] Properly handle child zygote Close #4720 --- native/jni/zygisk/hook.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/native/jni/zygisk/hook.cpp b/native/jni/zygisk/hook.cpp index 076610699..28a646216 100644 --- a/native/jni/zygisk/hook.cpp +++ b/native/jni/zygisk/hook.cpp @@ -267,6 +267,10 @@ void HookContext::nativeSpecializeAppProcess_post() { run_modules_post(); if (info.is_magisk_app) { setenv("ZYGISK_ENABLED", "1", 1); + } else if (args->is_child_zygote && *args->is_child_zygote) { + // If we are in child zygote, unhook all zygisk hooks + // Modules still have their code loaded and can do whatever they want + unhook_functions(); } } g_ctx = nullptr;