Move first stage unload before fork

This commit is contained in:
topjohnwu
2021-11-02 21:53:33 -07:00
parent e20b07fa24
commit 63f670fc36
3 changed files with 16 additions and 25 deletions

View File

@@ -140,7 +140,9 @@ DCL_HOOK_FUNC(int, jniRegisterNativeMethods,
}
// Skip actual fork and return cached result if applicable
// Also unload first stage zygisk if necessary
DCL_HOOK_FUNC(int, fork) {
unload_first_stage();
return (g_ctx && g_ctx->pid >= 0) ? g_ctx->pid : old_fork();
}