From 83af0497e437a3bb786d13a27bdd223eaa176a53 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 27 Sep 2017 04:35:16 +0800 Subject: [PATCH] Don't use dummy directory; directly use tmpfs --- jni/daemon/bootstages.c | 13 ++++++------- jni/include/magisk.h | 1 - jni/magiskhide/proc_monitor.c | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/jni/daemon/bootstages.c b/jni/daemon/bootstages.c index a50fe09ff..a2117a675 100644 --- a/jni/daemon/bootstages.c +++ b/jni/daemon/bootstages.c @@ -276,14 +276,13 @@ static void clone_skeleton(struct node_entry *node) { } closedir(dir); - snprintf(buf, PATH_MAX, "%s%s", DUMMDIR, full_path); - mkdir_p(buf, 0755); - clone_attr(full_path, buf); - if (node->status & IS_SKEL) - bind_mount(buf, full_path); + if (node->status & IS_SKEL) { + LOGI("tmpfs: %s\n", full_path); + mount("tmpfs", full_path, "tmpfs", 0, NULL); + } vec_for_each(node->children, child) { - snprintf(buf, PATH_MAX, "%s%s/%s", DUMMDIR, full_path, child->name); + snprintf(buf, PATH_MAX, "%s/%s", full_path, child->name); // Create the dummy file/directory if (IS_DIR(child)) @@ -303,7 +302,7 @@ static void clone_skeleton(struct node_entry *node) { // Mount from module file to dummy file snprintf(buf2, PATH_MAX, "%s/%s%s/%s", MOUNTPOINT, child->module, full_path, child->name); } else if (child->status & (IS_SKEL | IS_INTER)) { - // It's a intermediate folder, recursive clone + // It's an intermediate folder, recursive clone clone_skeleton(child); continue; } else if (child->status & IS_DUMMY) { diff --git a/jni/include/magisk.h b/jni/include/magisk.h index 5ba82bfda..fb8616247 100644 --- a/jni/include/magisk.h +++ b/jni/include/magisk.h @@ -31,7 +31,6 @@ #define MANAGERAPK DATABIN "/magisk.apk" #define MAGISKTMP "/dev/magisk" #define MIRRDIR MAGISKTMP "/mirror" -#define DUMMDIR MAGISKTMP "/dummy" #define BBPATH MAGISKTMP "/bin" #define CACHEMOUNT "/cache/magisk_mount" diff --git a/jni/magiskhide/proc_monitor.c b/jni/magiskhide/proc_monitor.c index 047fa9525..d41d4bf69 100644 --- a/jni/magiskhide/proc_monitor.c +++ b/jni/magiskhide/proc_monitor.c @@ -137,9 +137,9 @@ static void hide_daemon(int pid) { vec_init(&mount_list); file_to_vector(buffer, &mount_list); - // Unmount any loop mounts and dummy mounts + // Unmount any loop mounts vec_for_each(&mount_list, line) { - if (strstr(line, "/dev/block/loop") || strstr(line, DUMMDIR)) { + if (strstr(line, "/dev/block/loop")) { sscanf(line, "%*s %4096s", buffer); lazy_unmount(buffer); }