From 3404a4fea809d2ce2525d7e65c4847eb3ee4203a Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:12:17 +0800 Subject: [PATCH] KernelSU: Fix sus mounts not umounted for iso service that spawned by zygote directly Co-authored-by: simonpunk Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> --- kernel/core_hook.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index 4192db09..c8d05bf9 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -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 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); current->susfs_task_state |= TASK_STRUCT_NON_ROOT_USER_APP_PROC; task_unlock(current); + goto out_susfs_try_umount_all; } #endif @@ -1245,6 +1257,7 @@ out_ksu_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_try_umount_all(new_uid.val); #else