From 823623a96f9a9e136184680a193637b763ce679c Mon Sep 17 00:00:00 2001 From: ThePedroo Date: Fri, 27 Jun 2025 14:39:36 -0300 Subject: [PATCH] improve: set `ZYGISK_ENABLED` in all supported managers' process This commit sets the environment variable "ZYGISK_ENABLED" for all managers' process, not limiting to Magisk anymore, so that managers can easily detect (Re)Zygisk. --- loader/src/injector/hook.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/loader/src/injector/hook.cpp b/loader/src/injector/hook.cpp index 4695031..42c2605 100644 --- a/loader/src/injector/hook.cpp +++ b/loader/src/injector/hook.cpp @@ -773,15 +773,18 @@ void ZygiskContext::app_specialize_pre() { update_mnt_ns(Clean, true); } - if ((info_flags & (PROCESS_IS_MANAGER | PROCESS_ROOT_IS_MAGISK)) == (PROCESS_IS_MANAGER | PROCESS_ROOT_IS_MAGISK)) { + if ((info_flags & PROCESS_IS_MANAGER) == PROCESS_IS_MANAGER) { LOGD("Manager process detected. Notifying that Zygisk has been enabled."); /* INFO: This environment variable is related to Magisk Zygisk/Manager. It it used by Magisk's Zygisk to communicate to Magisk Manager whether - Zygisk is working or not. + Zygisk is working or not, allowing Zygisk modules to both work properly + and for the manager to mark Zygisk as enabled. - To allow Zygisk modules to both work properly and for the manager to - identify Zygisk, being it not built-in, as working, we also set it. */ + However, to enhance capabilities of root managers, it is also set for + any other supported manager, so that, if they wish, they can recognize + if Zygisk is enabled. + */ setenv("ZYGISK_ENABLED", "1", 1); } else { /* INFO: Because we load directly from the file, we need to do it before we umount