Make denylist work when zygisk is disabled

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
This commit is contained in:
vvb2060
2022-08-08 22:30:03 +08:00
committed by John Wu
parent 652a26d5d9
commit 60e8415369
9 changed files with 302 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ use base::{
};
use crate::consts::{MODULEMNT, MODULEROOT, PREINITDEV, PREINITMIRR, WORKERDIR};
use crate::ffi::{get_magisk_tmp, resolve_preinit_dir};
use crate::ffi::{get_magisk_tmp, resolve_preinit_dir, switch_mnt_ns};
use crate::get_prop;
pub fn setup_mounts() {
@@ -275,7 +275,14 @@ pub fn find_preinit_device() -> String {
.to_string()
}
pub fn revert_unmount() {
pub fn revert_unmount(pid: i32) {
if pid > 0 {
if switch_mnt_ns(pid) != 0 {
return;
}
debug!("denylist: handling PID=[{}]", pid);
}
let mut targets = Vec::new();
// Unmount Magisk tmpfs and mounts from module files