kernel: try introduce like susfs's method to fix prctl delay

Co-authored-by: AlexLiuDev233 <wzylin11@outlook.com>
This commit is contained in:
ShirkNeko
2025-10-25 15:27:42 +08:00
parent 64ee09fd12
commit bf1a45963b
2 changed files with 18 additions and 0 deletions

View File

@@ -471,6 +471,9 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
u32 *result = (u32 *)arg5;
u32 reply_ok = KERNEL_SU_OPTION;
uid_t current_uid_val = current_uid().val;
if (likely(ksu_is_current_proc_umounted())) { // prevent side channel attack in ksu side
return 0;
}
#ifdef CONFIG_KSU_MANUAL_SU
is_manual_su_cmd = (arg2 == CMD_SU_ESCALATION_REQUEST ||
@@ -1082,6 +1085,10 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
// try umount ksu temp path
try_umount("/debug_ramdisk", false, MNT_DETACH);
get_task_struct(current); // delay fix
ksu_set_current_proc_umounted();
put_task_struct(current);
return 0;
}