From bc21a1fb71c66f65435dc8242566299841e0a16a Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 22 Nov 2017 16:04:24 +0800 Subject: [PATCH] Update internal paths --- build.py | 1 + java | 2 +- jni/core/bootstages.c | 3 --- jni/include/magisk.h | 7 ++++--- jni/magiskhide/proc_monitor.c | 11 ++++++----- jni/magiskpolicy | 2 +- scripts/util_functions.sh | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build.py b/build.py index 6b35b284d..eb8dc0ebc 100755 --- a/build.py +++ b/build.py @@ -78,6 +78,7 @@ def build_all(args): build_apk(args) zip_main(args) zip_uninstaller(args) + build_snet(args) def build_binary(args): header('* Building Magisk binaries') diff --git a/java b/java index 389299afd..f520fe36b 160000 --- a/java +++ b/java @@ -1 +1 @@ -Subproject commit 389299afd103337ec3ab787278ac56ac249f9195 +Subproject commit f520fe36bd503cd7fee779b3b5c68723f6e0d098 diff --git a/jni/core/bootstages.c b/jni/core/bootstages.c index a7b1c2d8d..20df2acd7 100644 --- a/jni/core/bootstages.c +++ b/jni/core/bootstages.c @@ -558,9 +558,6 @@ void fix_filecon() { int dirfd = xopen(MOUNTPOINT, O_RDONLY | O_CLOEXEC); restorecon(dirfd, 0); close(dirfd); - dirfd = xopen(DATABIN, O_RDONLY | O_CLOEXEC); - restorecon(dirfd, 1); - close(dirfd); } /**************** diff --git a/jni/include/magisk.h b/jni/include/magisk.h index c1eb645a2..b5b86c571 100644 --- a/jni/include/magisk.h +++ b/jni/include/magisk.h @@ -21,9 +21,9 @@ #define DISABLEFILE "/cache/.disable_magisk" #define UNINSTALLER "/cache/magisk_uninstaller.sh" #define CACHEMOUNT "/cache/magisk_mount" -#define MAGISKTMP "/dev/magisk" +#define MAGISKTMP "/sbin/.core" #define MIRRDIR MAGISKTMP "/mirror" -#define BBPATH MAGISKTMP "/bin" +#define BBPATH MAGISKTMP "/busybox" #define MOUNTPOINT MAGISKTMP "/img" #define FAKEPOINT "/magisk" #define COREDIR MOUNTPOINT "/.core" @@ -31,7 +31,8 @@ #define HIDELIST COREDIR "/hidelist" #define MAINIMG "/data/magisk.img" #define DATABIN "/data/magisk" -#define MANAGERAPK DATABIN "/magisk.apk" +#define MANAGERAPK MIRRDIR "/bin/magisk.apk" +#define MAGISKRC "/init.magisk.rc" #define SELINUX_PATH "/sys/fs/selinux/" diff --git a/jni/magiskhide/proc_monitor.c b/jni/magiskhide/proc_monitor.c index 92eaab4c3..75ba5eb93 100644 --- a/jni/magiskhide/proc_monitor.c +++ b/jni/magiskhide/proc_monitor.c @@ -110,9 +110,9 @@ static void hide_daemon(int pid, int ppid) { } } - // Unmount dummy skeletons, /sbin links, and mirrors + // Unmount dummy skeletons, /sbin links vec_for_each(&mount_list, line) { - if (strstr(line, "tmpfs /system") || strstr(line, "tmpfs /vendor") || strstr(line, "tmpfs /sbin") || strstr(line, MIRRDIR)) { + if (strstr(line, "tmpfs /system") || strstr(line, "tmpfs /vendor") || strstr(line, "tmpfs /sbin")) { sscanf(line, "%*s %4096s", buffer); lazy_unmount(buffer); } @@ -134,9 +134,6 @@ static void hide_daemon(int pid, int ppid) { free(line); } - xmount(NULL, "/", NULL, MS_REMOUNT, NULL); - unlink(FAKEPOINT); - exit: // Send resume signal kill(pid, SIGCONT); @@ -250,6 +247,10 @@ void proc_monitor() { * The setns system call do not support multithread processes * We have to fork a new process, setns, then do the unmounts */ + xmount(NULL, "/", NULL, MS_REMOUNT, NULL); + unlink(FAKEPOINT); + unlink(MAGISKRC); + xmount(NULL, "/", NULL, MS_REMOUNT | MS_RDONLY, NULL); ++hide_queue; int selfpid = getpid(); if (fork_dont_care() == 0) diff --git a/jni/magiskpolicy b/jni/magiskpolicy index 9e9682416..b7e717ee8 160000 --- a/jni/magiskpolicy +++ b/jni/magiskpolicy @@ -1 +1 @@ -Subproject commit 9e96824161ddf1d6af516f44cad4d0e904a7abed +Subproject commit b7e717ee8c49d3f2ae153b8ea8de6c932032c20a diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index 3d6f5fb49..55def92cd 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -257,11 +257,11 @@ api_level_arch_detect() { } boot_actions() { - if [ ! -d /dev/magisk/mirror/bin ]; then - mkdir -p /dev/magisk/mirror/bin - mount -o bind $MAGISKBIN /dev/magisk/mirror/bin + if [ ! -d /sbin/.core/mirror/bin ]; then + mkdir -p /sbin/.core/mirror/bin + mount -o bind $MAGISKBIN /sbin/.core/mirror/bin fi - MAGISKBIN=/dev/magisk/mirror/bin + MAGISKBIN=/sbin/.core/mirror/bin } recovery_actions() {