From 62e29fee744cc4a521bf64b4f7c0a7798fdf4f2f Mon Sep 17 00:00:00 2001 From: Wang Han <416810799@qq.com> Date: Sat, 12 Jul 2025 23:49:59 +0800 Subject: [PATCH] Treat bind mount failure same as C++ implementation This fixes #9139 and #9174. --- native/src/core/module.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/native/src/core/module.rs b/native/src/core/module.rs index d930a7a61..0be060764 100644 --- a/native/src/core/module.rs +++ b/native/src/core/module.rs @@ -31,8 +31,10 @@ macro_rules! module_log { #[allow(unused_variables)] fn bind_mount(reason: &str, src: &Utf8CStr, dest: &Utf8CStr, rec: bool) -> OsResultStatic<()> { module_log!(reason, dest, src); - src.bind_mount_to(dest, rec)?; - dest.remount_mount_point_flags(MS_RDONLY)?; + // Ignore any kind of error here. If a single bind mount fails due to selinux permissions or + // kernel limitations, don't let it break module mount entirely. + src.bind_mount_to(dest, rec).log_ok(); + dest.remount_mount_point_flags(MS_RDONLY).log_ok(); Ok(()) } @@ -510,7 +512,7 @@ fn inject_zygisk_bins(system: &mut FsNode) { #[cfg(target_pointer_width = "32")] bin_path.append_path("magisk"); - // There are some devices that announce ABI as 64 bit only, but ship with linker64 + // There are some devices that announce ABI as 64 bit only, but ship with linker // because they make use of a special 32 bit to 64 bit translator (such as tango). // In this case, magisk32 does not exist, so inserting it will cause bind mount // failure and affect module mount. Native bridge injection does not support these