From b24c74ac0d23be0176bd947baaa59c947482fbeb Mon Sep 17 00:00:00 2001 From: ThePedroo Date: Wed, 23 Apr 2025 13:55:22 -0300 Subject: [PATCH] fix: not umounting KSU-specific `/system` mounts This commit fixes the issue that ReZygisk would skip all "/system" mounts, and not only the ones made by modules, leaving unexpected mounts mounted in app processes. KernelSU itself create some mounts such as "/system/app", which need to be umounted. To fix that, we will check if they come from "/data/modules", and if so, skip and not umount. That's not needed in Magisk as it doesn't create such mounts as far as I am aware. --- zygiskd/src/utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zygiskd/src/utils.c b/zygiskd/src/utils.c index 8c2d00b..8e3d244 100644 --- a/zygiskd/src/utils.c +++ b/zygiskd/src/utils.c @@ -639,7 +639,11 @@ enum mns_umount_state unmount_root(bool modules_only, struct root_impl impl) { if (strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0) should_unmount = true; } else { - if (strncmp(mount.target, "/system/", strlen("/system/")) == 0) continue; + /* INFO: KernelSU has its own /system mounts, so we only skip the mount + if they are from a module, not KSU itself. + */ + if (strncmp(mount.target, "/system/", strlen("/system/")) == 0 && + strncmp(mount.root, "/adb/modules", strlen("/adb/modules")) == 0) continue; if (strcmp(mount.source, source_name) == 0) should_unmount = true; if (strncmp(mount.root, "/adb/modules", strlen("/adb/modules")) == 0) should_unmount = true;