On denylist != do unmount

This commit is contained in:
topjohnwu 2021-09-18 12:44:42 -07:00
parent 63cfe7b47b
commit db20f65d7c

View File

@ -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();