diff --git a/module/build.gradle.kts b/module/build.gradle.kts index a9c52fb..5a5f184 100644 --- a/module/build.gradle.kts +++ b/module/build.gradle.kts @@ -53,7 +53,7 @@ androidComponents.onVariants { variant -> into(moduleDir) from("${rootProject.projectDir}/README.md") from("$projectDir/src") { - exclude("module.prop", "customize.sh", "post-fs-data.sh", "service.sh", "uninstall.sh", "mazoku") + exclude("module.prop", "customize.sh", "post-fs-data.sh", "service.sh", "uninstall.sh") filter("eol" to FixCrLfFilter.CrLf.newInstance("lf")) } from("$projectDir/src") { @@ -65,7 +65,6 @@ androidComponents.onVariants { variant -> "versionCode" to verCode ) } - from("$projectDir/src/mazoku") from("$projectDir/src") { include("customize.sh", "post-fs-data.sh", "service.sh", "uninstall.sh") val tokens = mapOf( @@ -122,7 +121,6 @@ androidComponents.onVariants { variant -> set.add(Pair(root.file("sepolicy.rule").asFile, null)) set.add(Pair(root.file("post-fs-data.sh").asFile, null)) set.add(Pair(root.file("service.sh").asFile, null)) - set.add(Pair(root.file("mazoku").asFile, null)) set.add( Pair( root.file("lib/libzygisk.so").asFile, diff --git a/module/src/customize.sh b/module/src/customize.sh index 741581f..649b707 100644 --- a/module/src/customize.sh +++ b/module/src/customize.sh @@ -104,7 +104,6 @@ extract "$ZIPFILE" 'module.prop' "$MODPATH" extract "$ZIPFILE" 'post-fs-data.sh' "$MODPATH" extract "$ZIPFILE" 'service.sh' "$MODPATH" extract "$ZIPFILE" 'uninstall.sh' "$MODPATH" -extract "$ZIPFILE" 'mazoku' "$MODPATH" mv "$TMPDIR/sepolicy.rule" "$MODPATH" mkdir "$MODPATH/bin" diff --git a/module/src/mazoku b/module/src/mazoku deleted file mode 100644 index a7cd563..0000000 --- a/module/src/mazoku +++ /dev/null @@ -1 +0,0 @@ -c—„ˆ]œ‘ „[{Ú­‚BÒuÞ5=ÙrEUÕZ„Ê¿èã<¦5ß_oñãMéL•l•¢ÛQ#ÿøœC¾}ù eäfjÙ‚/©7³‡Ž(â´gstate = Inexistent; - - return; - } - - /* INFO: /debug_ramdisk/magisk64 (or 32) doesn't exist but /debug_ramdisk/magisk does */ - strcpy(path_to_magisk, BITLESS_DEBUG_RAMDISK_MAGISK); - } else { - /* INFO: /sbin/magisk doesn't exist but /debug_ramdisk/magisk does */ - strcpy(path_to_magisk, DEBUG_RAMDISK_MAGISK); - } - } else { - /* INFO: /sbin/magisk64 (or 32) doesn't exist but /sbin/magisk does */ - strcpy(path_to_magisk, BITLESS_SBIN_MAGISK); + continue; } - } else { - /* INFO: /sbin/magisk64 (or 32) exists */ - strcpy(path_to_magisk, SBIN_MAGISK); + + strcpy(path_to_magisk, magisk_files[i]); + + break; + } + + if (path_to_magisk[0] == '\0') { + state->state = Inexistent; + + return; } char *argv[4] = { "magisk", "-v", NULL, NULL }; diff --git a/zygiskd/src/utils.c b/zygiskd/src/utils.c index 6922599..8c2d00b 100644 --- a/zygiskd/src/utils.c +++ b/zygiskd/src/utils.c @@ -358,7 +358,7 @@ bool exec_command(char *restrict buf, size_t len, const char *restrict file, cha dup2(link[1], STDOUT_FILENO); close(link[0]); close(link[1]); - + execv(file, argv); LOGE("execv failed: %s\n", strerror(errno)); @@ -626,7 +626,7 @@ enum mns_umount_state unmount_root(bool modules_only, struct root_impl impl) { char source_name[LONGEST_ROOT_IMPL_NAME]; if (impl.impl == KernelSU) strcpy(source_name, "KSU"); else strcpy(source_name, "APatch"); - + const char **targets_to_unmount = NULL; size_t num_targets = 0; @@ -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) should_unmount = true; } else { + if (strncmp(mount.target, "/system/", strlen("/system/")) == 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; if (strncmp(mount.target, "/data/adb/modules", strlen("/data/adb/modules")) == 0) should_unmount = true; @@ -675,7 +677,7 @@ enum mns_umount_state unmount_root(bool modules_only, struct root_impl impl) { } case Magisk: { LOGI("[Magisk] Unmounting root %s modules\n", modules_only ? "only" : "with"); - + const char **targets_to_unmount = NULL; size_t num_targets = 0; @@ -683,27 +685,18 @@ enum mns_umount_state unmount_root(bool modules_only, struct root_impl impl) { struct mountinfo mount = mounts.mounts[i]; bool should_unmount = false; - if ( - ( - modules_only && - ( - strcmp(mount.source, "magisk") == 0 || - strncmp(mount.target, "/debug_ramdisk", strlen("/debug_ramdisk")) == 0 || - strncmp(mount.target, "/system/bin", strlen("/system/bin")) == 0 - ) - ) || - ( - !modules_only && - ( - 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 (modules_only) { + 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, "/system/bin", strlen("/system/bin")) == 0) should_unmount = true; + } else { + if (strncmp(mount.target, "/system/", strlen("/system/")) == 0) continue; + + 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; + 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; } if (!should_unmount) continue;