mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-11 18:53:37 +00:00
Cancel recursive bind
This commit is contained in:
parent
aa7846c1c0
commit
a18a440236
@ -121,7 +121,7 @@ static void switch_root(const string &path) {
|
|||||||
|
|
||||||
#define PREINITMNT MIRRDIR "/preinit"
|
#define PREINITMNT MIRRDIR "/preinit"
|
||||||
|
|
||||||
static void mount_preinit_dir(string path, string preinit_dev) {
|
static void mount_preinit_dir(string preinit_dev) {
|
||||||
if (preinit_dev.empty()) return;
|
if (preinit_dev.empty()) return;
|
||||||
strcpy(blk_info.partname, preinit_dev.data());
|
strcpy(blk_info.partname, preinit_dev.data());
|
||||||
strcpy(blk_info.block_dev, PREINITDEV);
|
strcpy(blk_info.block_dev, PREINITDEV);
|
||||||
@ -156,7 +156,6 @@ static void mount_preinit_dir(string path, string preinit_dev) {
|
|||||||
} else {
|
} else {
|
||||||
LOGD("preinit: %s\n", preinit_dir.data());
|
LOGD("preinit: %s\n", preinit_dir.data());
|
||||||
xmount(preinit_dir.data(), PREINITMIRR, nullptr, MS_BIND, nullptr);
|
xmount(preinit_dir.data(), PREINITMIRR, nullptr, MS_BIND, nullptr);
|
||||||
mount_list.emplace_back(path += "/" PREINITMIRR);
|
|
||||||
}
|
}
|
||||||
xumount2(PREINITMNT, MNT_DETACH);
|
xumount2(PREINITMNT, MNT_DETACH);
|
||||||
} else {
|
} else {
|
||||||
@ -265,7 +264,7 @@ void MagiskInit::setup_tmp(const char *path) {
|
|||||||
xmkdir(BLOCKDIR, 0);
|
xmkdir(BLOCKDIR, 0);
|
||||||
xmkdir(WORKERDIR, 0);
|
xmkdir(WORKERDIR, 0);
|
||||||
|
|
||||||
mount_preinit_dir(path, preinit_dev);
|
mount_preinit_dir(preinit_dev);
|
||||||
|
|
||||||
cp_afc(".backup/.magisk", INTLROOT "/config");
|
cp_afc(".backup/.magisk", INTLROOT "/config");
|
||||||
rm_rf(".backup");
|
rm_rf(".backup");
|
||||||
@ -275,7 +274,7 @@ void MagiskInit::setup_tmp(const char *path) {
|
|||||||
xsymlink("./magisk", applet_names[i]);
|
xsymlink("./magisk", applet_names[i]);
|
||||||
xsymlink("./magiskpolicy", "supolicy");
|
xsymlink("./magiskpolicy", "supolicy");
|
||||||
|
|
||||||
xmount(".", path, nullptr, MS_BIND | MS_REC, nullptr);
|
xmount(".", path, nullptr, MS_BIND, nullptr);
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
}
|
}
|
||||||
|
@ -231,11 +231,10 @@ void MagiskInit::patch_ro_root() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_tmp(tmp_dir.data());
|
setup_tmp(tmp_dir.data());
|
||||||
chdir(tmp_dir.data());
|
chdir("/data");
|
||||||
|
|
||||||
// Recreate original sbin structure if necessary
|
|
||||||
if (tmp_dir == "/sbin") {
|
if (tmp_dir == "/sbin") {
|
||||||
// Mount system_root mirror
|
// Recreate original sbin structure
|
||||||
xmkdir(ROOTMIR, 0755);
|
xmkdir(ROOTMIR, 0755);
|
||||||
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
|
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
|
||||||
recreate_sbin(ROOTMIR "/sbin", true);
|
recreate_sbin(ROOTMIR "/sbin", true);
|
||||||
@ -280,7 +279,8 @@ void MagiskInit::patch_ro_root() {
|
|||||||
// Oculus Go will use a special sepolicy if unlocked
|
// Oculus Go will use a special sepolicy if unlocked
|
||||||
if (access("/sepolicy.unlocked", F_OK) == 0) {
|
if (access("/sepolicy.unlocked", F_OK) == 0) {
|
||||||
patch_sepolicy("/sepolicy.unlocked", ROOTOVL "/sepolicy.unlocked");
|
patch_sepolicy("/sepolicy.unlocked", ROOTOVL "/sepolicy.unlocked");
|
||||||
} else if ((access(SPLIT_PLAT_CIL, F_OK) != 0 && access("/sepolicy", F_OK) == 0) || !hijack_sepolicy()) {
|
} else if ((access(SPLIT_PLAT_CIL, F_OK) != 0 && access("/sepolicy", F_OK) == 0) ||
|
||||||
|
!hijack_sepolicy()) {
|
||||||
patch_sepolicy("/sepolicy", ROOTOVL "/sepolicy");
|
patch_sepolicy("/sepolicy", ROOTOVL "/sepolicy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user