Fix magisk --stop by making mirror shared

Previously mirror is private and then unshared to zygote, which
makes magisk --stop cannot propagate umount mirror to zygote.
This commit is contained in:
LoveSy 2023-12-22 13:29:12 +08:00 committed by John Wu
parent deedb462a0
commit 06687abffc

View File

@ -341,8 +341,12 @@ bool MagiskD::post_fs_data() const {
} }
early_abort: early_abort:
auto mirror_dir = get_magisk_tmp() + "/"s MIRRDIR;
// We still do magic mount because root itself might need it // We still do magic mount because root itself might need it
load_modules(); load_modules();
// make mirror dir as a shared mount to make magisk --stop work for other ns
xmount(nullptr, mirror_dir.data(), nullptr, MS_SHARED | MS_REC, nullptr);
LOGD("make %s shared\n", mirror_dir.data());
return safe_mode; return safe_mode;
} }