kernel & KernelSU: Replace kabi member susfs_task_state of tast_struct and use...

kernel & KernelSU: Replace kabi member susfs_task_state of tast_struct and use tast_struct->thread_info.flags instead; Fix for sus_path not working on some OEM devices; KSU_SUSFS requires CONFIG_THREAD_INFO_IN_TASK now;

- Since the kabi member is not guaranteed to be unused by OEM, that is why some deivces may conflict with the kabi member added by susfs, we should use less kabi member as much as possible.
- Luckily we have task_struct->thread_info that is enabled by all gki kernels just like kprobes, so we can utilize thread_info->flags for faster check, but it needs CONFIG_THREAD_INFO_IN_TASK to be on which should always be enabled
- Big thanks to fatalcoder524 (https://github.com/fatalcoder524) who did an excellent debug process for me

Co-authored-by: simonpunk <simonpunk2016@gmail.com>
This commit is contained in:
ShirkNeko
2025-07-07 13:13:07 +08:00
parent b8f9a448f2
commit f5541e215f
2 changed files with 3 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ menu "KernelSU - SUSFS"
config KSU_SUSFS config KSU_SUSFS
bool "KernelSU addon - SUSFS" bool "KernelSU addon - SUSFS"
depends on KSU depends on KSU
depends on THREAD_INFO_IN_TASK
default y default y
help help
Patch and Enable SUSFS to kernel with KernelSU. Patch and Enable SUSFS to kernel with KernelSU.

View File

@@ -1244,7 +1244,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
// the detection, really big helps here! // the detection, really big helps here!
else if (new_uid.val >= 90000 && new_uid.val < 1000000 && susfs_is_umount_for_zygote_iso_service_enabled) { else if (new_uid.val >= 90000 && new_uid.val < 1000000 && susfs_is_umount_for_zygote_iso_service_enabled) {
task_lock(current); task_lock(current);
current->susfs_task_state |= TASK_STRUCT_NON_ROOT_USER_APP_PROC; susfs_set_current_non_root_user_app_proc();
task_unlock(current); task_unlock(current);
goto out_susfs_try_umount_all; goto out_susfs_try_umount_all;
} }
@@ -1263,7 +1263,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
#ifdef CONFIG_KSU_SUSFS #ifdef CONFIG_KSU_SUSFS
else { else {
task_lock(current); task_lock(current);
current->susfs_task_state |= TASK_STRUCT_NON_ROOT_USER_APP_PROC; susfs_set_current_non_root_user_app_proc();
task_unlock(current); task_unlock(current);
} }
#endif #endif