Skip to content

Commit 046a659

Browse files
committed
fix: root-related mounts leak when using with Magisk
This commit fixes an issue where using ReZygisk together with Magisk could lead to root-related mounts being leaked, when using modules that mount to partitions such as "/system". This happens because Magisk sets the source of some of its mounts to "worker", which wasn't previously recognized. With that it also removes the whitelist for some "/system" mounts to not be umounted.
1 parent 6b92907 commit 046a659

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

zygiskd/src/utils.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -660,14 +660,7 @@ bool umount_root(struct root_impl impl) {
660660
struct mountinfo mount = mounts.mounts[i];
661661

662662
bool should_unmount = false;
663-
/* INFO: The root implementations have their own /system mounts, so we
664-
only skip the mount if they are from a module, not Magisk itself.
665-
*/
666-
if (strncmp(mount.target, "/system/", strlen("/system/")) == 0 &&
667-
strncmp(mount.root, "/adb/modules/", strlen("/adb/modules/")) == 0 &&
668-
strncmp(mount.target, "/system/etc/", strlen("/system/etc/")) != 0) continue;
669-
670-
if (strcmp(mount.source, source_name) == 0) should_unmount = true;
663+
if (strcmp(mount.source, source_name) == 0 || (impl.impl == Magisk && strcmp(mount.source, "worker") == 0)) should_unmount = true;
671664
if (strncmp(mount.target, "/data/adb/modules", strlen("/data/adb/modules")) == 0) should_unmount = true;
672665
if (strncmp(mount.root, "/adb/modules/", strlen("/adb/modules/")) == 0) should_unmount = true;
673666

0 commit comments

Comments
 (0)