From a460c54d086cd41380af9c24b0fd81798608aac4 Mon Sep 17 00:00:00 2001 From: ThePedroo Date: Thu, 24 Apr 2025 01:33:53 -0300 Subject: [PATCH] improve: `update_mnt_ns` logging; add: comment about "rooted denylisted" apps This commit improves logging for "update_mnt_ns" function, which now specifies which state it will update the mns to, for easier debugging. It also adds a note about the possibility of having apps with rooted permissions and also be denylisted in Magisk, causing weird behavior. --- loader/src/injector/hook.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/loader/src/injector/hook.cpp b/loader/src/injector/hook.cpp index 3ed2a7b..ff897f8 100644 --- a/loader/src/injector/hook.cpp +++ b/loader/src/injector/hook.cpp @@ -156,7 +156,13 @@ bool update_mnt_ns(enum mount_namespace_state mns_state, bool dry_run) { return false; } - LOGD("set mount namespace to [%s] fd=[%d]\n", ns_path, updated_ns); + const char *mns_state_str = NULL; + if (mns_state == Clean) mns_state_str = "clean"; + else if (mns_state == Module) mns_state_str = "module"; + else if (mns_state == Rooted) mns_state_str = "rooted"; + else mns_state_str = "unknown"; + + LOGD("set mount namespace to [%s] fd=[%d]: %s", ns_path, updated_ns, mns_state_str); if (setns(updated_ns, CLONE_NEWNS) == -1) { PLOGE("Failed to set mount namespace [%s]", ns_path); close(updated_ns); @@ -183,6 +189,11 @@ DCL_HOOK_FUNC(int, unshare, int flags) { update_mnt_ns(Module, false); } + /* INFO: There might be cases, specifically in Magisk, where the app is in + DenyList but also has root privileges. For those, it is up to the + user remove it, and the weird behavior is expected, as the weird + user behavior. */ + old_unshare(CLONE_NEWNS); }