Skip to content

Commit

Permalink
ksud: fix /debug_ramdisk not mounting
Browse files Browse the repository at this point in the history
Use mount::mount_tmpfs() which was brought back in
bff23c6
to allow both legacy and new implementations.

This fixes /debug_ramdisk not mounting for certain devices on magic
mount.

Reference to original usage in KernelSU:
https://github.com/tiann/KernelSU/blob/69f31abd62e4f275bb33c9b478961d09231f154d/userspace/ksud/src/init_event.rs#L194
  • Loading branch information
bryanyee33 committed Jan 3, 2025
1 parent bc530b1 commit 86cd7d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions userspace/ksud/src/init_event.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::defs::{KSU_MOUNT_SOURCE, NO_MOUNT_PATH, NO_TMPFS_PATH, TEMP_DIR};
use crate::defs::{NO_MOUNT_PATH, NO_TMPFS_PATH, TEMP_DIR};
use crate::module::{handle_updated_modules, prune_modules};
use crate::{assets, defs, ksucalls, restorecon, utils};
use crate::{assets, defs, ksucalls, mount, restorecon, utils};
use anyhow::{Context, Result};
use log::{info, warn};
use rustix::fs::{mount, MountFlags};
use std::path::Path;

pub fn on_post_data_fs() -> Result<()> {
Expand Down Expand Up @@ -69,7 +68,7 @@ pub fn on_post_data_fs() -> Result<()> {

// mount temp dir
if !Path::new(NO_TMPFS_PATH).exists() {
if let Err(e) = mount(KSU_MOUNT_SOURCE, TEMP_DIR, "tmpfs", MountFlags::empty(), "") {
if let Err(e) = mount::mount_tmpfs(TEMP_DIR) {
warn!("do temp dir mount failed: {}", e);
}
} else {
Expand Down
1 change: 1 addition & 0 deletions userspace/ksud/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod ksucalls;
#[cfg(target_os = "android")]
mod magic_mount;
mod module;
mod mount;
mod profile;
mod restorecon;
mod sepolicy;
Expand Down

0 comments on commit 86cd7d9

Please sign in to comment.