improve: not umount modules /system mounts

This commit creates a new behavior in ReZygisk umounting system where it now ignores "/system/..." mounts, as umounting them generally leads to unbootable system.
This commit is contained in:
ThePedroo
2025-04-16 02:04:40 -03:00
parent c37a5b1c8e
commit db24c1c439

View File

@@ -639,6 +639,8 @@ enum mns_umount_state unmount_root(bool modules_only, struct root_impl impl) {
if (strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0) if (strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0)
should_unmount = true; should_unmount = true;
} else { } else {
if (strncmp(mount.target, "/system/", strlen("/system/")) == 0) continue;
if (strcmp(mount.source, source_name) == 0) should_unmount = true; if (strcmp(mount.source, source_name) == 0) should_unmount = true;
if (strncmp(mount.root, "/adb/modules", strlen("/adb/modules")) == 0) should_unmount = true; if (strncmp(mount.root, "/adb/modules", strlen("/adb/modules")) == 0) should_unmount = true;
if (strncmp(mount.target, "/data/adb/modules", strlen("/data/adb/modules")) == 0) should_unmount = true; if (strncmp(mount.target, "/data/adb/modules", strlen("/data/adb/modules")) == 0) should_unmount = true;
@@ -683,27 +685,18 @@ enum mns_umount_state unmount_root(bool modules_only, struct root_impl impl) {
struct mountinfo mount = mounts.mounts[i]; struct mountinfo mount = mounts.mounts[i];
bool should_unmount = false; bool should_unmount = false;
if ( if (modules_only) {
( if (strcmp(mount.source, "magisk") == 0) should_unmount = true;
modules_only && if (strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0) should_unmount = true;
( if (strncmp(mount.target, "/system/bin", strlen("/system/bin")) == 0) should_unmount = true;
strcmp(mount.source, "magisk") == 0 || } else {
strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0 || if (strncmp(mount.target, "/system/", strlen("/system/")) == 0) continue;
strncmp(mount.target, "/system/bin", strlen("/system/bin")) == 0
) if (strcmp(mount.source, "magisk") == 0) should_unmount = true;
) || if (strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0) should_unmount = true;
( if (strncmp(mount.target, "/data/adb/modules", strlen("/data/adb/modules")) == 0) should_unmount = true;
!modules_only && if (strncmp(mount.root, "/adb/modules", strlen("/adb/modules")) == 0) should_unmount = true;
( if (strncmp(mount.target, "/system/bin", strlen("/system/bin")) == 0) should_unmount = true;
strcmp(mount.source, "magisk") == 0 ||
strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0 ||
strncmp(mount.target, "/data/adb/modules", strlen("/data/adb/modules")) == 0 ||
strncmp(mount.root, "/adb/modules", strlen("/adb/modules")) == 0 ||
strncmp(mount.target, "/system/bin", strlen("/system/bin")) == 0
)
)
) {
should_unmount = true;
} }
if (!should_unmount) continue; if (!should_unmount) continue;