From db20f65d7ccbe5479a382faa157a0ad7f068792b Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 18 Sep 2021 12:44:42 -0700 Subject: [PATCH] On denylist != do unmount --- native/jni/zygisk/hook.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/native/jni/zygisk/hook.cpp b/native/jni/zygisk/hook.cpp index 61c6c48af..2910838d3 100644 --- a/native/jni/zygisk/hook.cpp +++ b/native/jni/zygisk/hook.cpp @@ -140,7 +140,7 @@ DCL_HOOK_FUNC(int, fork) { // This is the latest point where we can still connect to the magiskd main socket DCL_HOOK_FUNC(int, selinux_android_setcontext, uid_t uid, int isSystemServer, const char *seinfo, const char *pkgname) { - if (g_ctx && g_ctx->info.on_denylist) { + if (g_ctx && g_ctx->flags[DENY_FLAG]) { if (remote_request_unmount() == 0) { LOGD("zygisk: mount namespace cleaned up\n"); } @@ -247,6 +247,7 @@ void HookContext::nativeSpecializeAppProcess_pre() { /* TODO: Handle MOUNT_EXTERNAL_NONE */ if (args->mount_external != 0 && info.on_denylist) { LOGI("zygisk: [%s] is on the denylist\n", process); + flags[DENY_FLAG] = true; } else { run_modules_pre(); } @@ -260,7 +261,7 @@ void HookContext::nativeSpecializeAppProcess_post() { } env->ReleaseStringUTFChars(args->nice_name, process); - if (info.on_denylist) { + if (flags[DENY_FLAG]) { self_unload(); } else { run_modules_post();