mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
Don't unshare after entering global namespace (#2373)
Some checks are pending
Build Manager / build-lkm (push) Waiting to run
Build Manager / build-ksud (macos-latest, aarch64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (macos-latest, x86_64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-pc-windows-gnu) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-manager (push) Blocked by required conditions
Clippy check / clippy (push) Waiting to run
Rustfmt check / format (push) Waiting to run
Some checks are pending
Build Manager / build-lkm (push) Waiting to run
Build Manager / build-ksud (macos-latest, aarch64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (macos-latest, x86_64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-pc-windows-gnu) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-manager (push) Blocked by required conditions
Clippy check / clippy (push) Waiting to run
Rustfmt check / format (push) Waiting to run
Global namespace is usually used to publicly apply mounts so calling unshare after entering root namespace is not desired bahavior. This also keeps -M option same as Magisk.
This commit is contained in:
parent
0da9b123fa
commit
38027c9793
@ -305,7 +305,6 @@ pub fn run() -> Result<()> {
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
{
|
||||
utils::switch_mnt_ns(1)?;
|
||||
utils::unshare_mnt_ns()?;
|
||||
}
|
||||
match command {
|
||||
Module::Install { zip } => module::install_module(&zip),
|
||||
|
@ -26,7 +26,6 @@ pub fn grant_root(global_mnt: bool) -> Result<()> {
|
||||
command.pre_exec(move || {
|
||||
if global_mnt {
|
||||
let _ = utils::switch_mnt_ns(1);
|
||||
let _ = utils::unshare_mnt_ns();
|
||||
}
|
||||
Result::Ok(())
|
||||
})
|
||||
@ -263,7 +262,6 @@ pub fn root_shell() -> Result<()> {
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
if mount_master {
|
||||
let _ = utils::switch_mnt_ns(1);
|
||||
let _ = utils::unshare_mnt_ns();
|
||||
}
|
||||
|
||||
set_identity(uid, gid, &groups);
|
||||
|
@ -141,12 +141,6 @@ pub fn switch_mnt_ns(pid: i32) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub fn unshare_mnt_ns() -> Result<()> {
|
||||
unshare(UnshareFlags::NEWNS)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn switch_cgroup(grp: &str, pid: u32) {
|
||||
let path = Path::new(grp).join("cgroup.procs");
|
||||
if !path.exists() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user