KernelSU: Fix sus mounts not umounted for iso service that spawned by zygote directly

Co-authored-by: simonpunk <simonpunk2016@gmail.com>
Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
ShirkNeko
2025-06-25 12:12:17 +08:00
parent 8c9692c350
commit 3404a4fea8

View File

@@ -1202,6 +1202,17 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
} }
} }
} }
// - here we check if uid is a isolated service spawned by zygote directly
// - Apps that do not use "useAppZyogte" to start a isolated service will be directly
// spawned by zygote which KSU will ignore it by default, the only fix for now is to
// force a umount for those uid
// - Therefore make sure your root app doesn't use isolated service for root access
if (new_uid.val >= 90000 && new_uid.val < 1000000) {
task_lock(current);
current->susfs_task_state |= TASK_STRUCT_NON_ROOT_USER_APP_PROC;
task_unlock(current);
goto out_susfs_try_umount_all;
}
#endif #endif
if (!is_appuid(new_uid) || is_unsupported_uid(new_uid.val)) { if (!is_appuid(new_uid) || is_unsupported_uid(new_uid.val)) {
@@ -1218,6 +1229,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
task_lock(current); task_lock(current);
current->susfs_task_state |= TASK_STRUCT_NON_ROOT_USER_APP_PROC; current->susfs_task_state |= TASK_STRUCT_NON_ROOT_USER_APP_PROC;
task_unlock(current); task_unlock(current);
goto out_susfs_try_umount_all;
} }
#endif #endif
@@ -1245,6 +1257,7 @@ out_ksu_try_umount:
#ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT #ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT
out_susfs_try_umount_all:
// susfs come first, and lastly umount by ksu, make sure umount in reversed order // susfs come first, and lastly umount by ksu, make sure umount in reversed order
susfs_try_umount_all(new_uid.val); susfs_try_umount_all(new_uid.val);
#else #else