ksud, kernel: Pick some upstream changes and remove unused functions
* Upstream commit:
f130f7572f
Signed-off-by: Faris <rsuntk@yukiprjkt.my.id>
This commit is contained in:
@@ -1007,9 +1007,6 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
|
|||||||
try_umount("/system_ext", true, 0);
|
try_umount("/system_ext", true, 0);
|
||||||
try_umount("/data/adb/modules", false, MNT_DETACH);
|
try_umount("/data/adb/modules", false, MNT_DETACH);
|
||||||
|
|
||||||
// try umount ksu temp path
|
|
||||||
try_umount("/debug_ramdisk", false, MNT_DETACH);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,25 +87,6 @@ pub fn on_post_data_fs() -> Result<()> {
|
|||||||
warn!("KPM: Failed to load KPM modules: {}", e);
|
warn!("KPM: Failed to load KPM modules: {}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let tmpfs_path = find_tmp_path();
|
|
||||||
// for compatibility
|
|
||||||
let no_mount = Path::new(NO_TMPFS_PATH).exists() || Path::new(NO_MOUNT_PATH).exists();
|
|
||||||
|
|
||||||
// mount temp dir
|
|
||||||
if !no_mount {
|
|
||||||
if let Err(e) = mount(
|
|
||||||
KSU_MOUNT_SOURCE,
|
|
||||||
&tmpfs_path,
|
|
||||||
"tmpfs",
|
|
||||||
MountFlags::empty(),
|
|
||||||
"",
|
|
||||||
) {
|
|
||||||
warn!("do temp dir mount failed: {}", e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
info!("no tmpfs requested");
|
|
||||||
}
|
|
||||||
|
|
||||||
// exec modules post-fs-data scripts
|
// exec modules post-fs-data scripts
|
||||||
// TODO: Add timeout
|
// TODO: Add timeout
|
||||||
if let Err(e) = crate::module::exec_stage_script("post-fs-data", true) {
|
if let Err(e) = crate::module::exec_stage_script("post-fs-data", true) {
|
||||||
@@ -117,9 +98,10 @@ pub fn on_post_data_fs() -> Result<()> {
|
|||||||
warn!("load system.prop failed: {e}");
|
warn!("load system.prop failed: {e}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tmpfs_path = find_tmp_path();
|
||||||
// mount module systemlessly by magic mount
|
// mount module systemlessly by magic mount
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
if !no_mount {
|
if !Path::new(NO_MOUNT_PATH).exists() {
|
||||||
if let Err(e) = crate::magic_mount::magic_mount(&tmpfs_path) {
|
if let Err(e) = crate::magic_mount::magic_mount(&tmpfs_path) {
|
||||||
warn!("do systemless mount failed: {e}");
|
warn!("do systemless mount failed: {e}");
|
||||||
}
|
}
|
||||||
@@ -152,16 +134,6 @@ pub fn on_post_data_fs() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
pub fn mount_modules_systemlessly() -> Result<()> {
|
|
||||||
crate::magic_mount::magic_mount(&find_tmp_path())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
|
||||||
pub fn mount_modules_systemlessly() -> Result<()> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_stage(stage: &str, block: bool) {
|
fn run_stage(stage: &str, block: bool) {
|
||||||
utils::umask(0);
|
utils::umask(0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user