kernel & KernelSU: Added switch for enabling/disabling umount for zygote...
kernel & KernelSU: Added switch for enabling/disabling umount for zygote spawned isolated service process - Some modules that overlay sysyem files like framework or other overlay apk may crash when all iso services are umounted by susfs, so a switch is made here for users to switch on/off this funtion at anytime when they need it or want to test it - By default it is disabled in kernel, run "ksu_susfs umount_for_zygote_iso_service <0|1>" to switch on/off the function in userspace - Also user can create new file to "/data/adb/susfs_umount_for_zygote_iso_service" to enable it in kernel on each boot - Alternatively, disable this function and use other modules to handle the umount for iso services until a better solution is found Co-authored-by: simonpunk <simonpunk2016@gmail.com>
This commit is contained in:
@@ -75,6 +75,7 @@ extern void susfs_run_try_umount_for_current_mnt_ns(void);
|
||||
#endif // #ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
static bool susfs_is_umount_for_zygote_system_process_enabled = false;
|
||||
static bool susfs_is_umount_for_zygote_iso_service_enabled = false;
|
||||
extern bool susfs_hide_sus_mnts_for_all_procs;
|
||||
#endif // #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
#ifdef CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT
|
||||
@@ -675,6 +676,18 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
|
||||
pr_info("susfs: copy_to_user() failed\n");
|
||||
return 0;
|
||||
}
|
||||
if (arg2 == CMD_SUSFS_UMOUNT_FOR_ZYGOTE_ISO_SERVICE) {
|
||||
int error = 0;
|
||||
if (arg3 != 0 && arg3 != 1) {
|
||||
pr_err("susfs: CMD_SUSFS_UMOUNT_FOR_ZYGOTE_ISO_SERVICE -> arg3 can only be 0 or 1\n");
|
||||
return 0;
|
||||
}
|
||||
susfs_is_umount_for_zygote_iso_service_enabled = arg3;
|
||||
pr_info("susfs: CMD_SUSFS_UMOUNT_FOR_ZYGOTE_ISO_SERVICE -> susfs_is_umount_for_zygote_iso_service_enabled: %lu\n", arg3);
|
||||
if (copy_to_user((void __user*)arg5, &error, sizeof(error)))
|
||||
pr_info("susfs: copy_to_user() failed\n");
|
||||
return 0;
|
||||
}
|
||||
#endif //#ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
|
||||
#ifdef CONFIG_KSU_SUSFS_SUS_KSTAT
|
||||
if (arg2 == CMD_SUSFS_ADD_SUS_KSTAT) {
|
||||
@@ -1206,18 +1219,20 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
|
||||
goto out_ksu_try_umount;
|
||||
}
|
||||
}
|
||||
}
|
||||
// - 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) {
|
||||
// - Kudos to ThePedroo, the author and maintainer of Rezygisk for finding and reporting
|
||||
// the detection, really big helps here!
|
||||
else if (new_uid.val >= 90000 && new_uid.val < 1000000 && susfs_is_umount_for_zygote_iso_service_enabled) {
|
||||
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)) {
|
||||
@@ -1234,7 +1249,6 @@ 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user