kernel: Add legacy compatibility fallback
This commit is contained in:
@@ -256,6 +256,7 @@ int ksu_handle_setresuid(uid_t ruid, uid_t euid, uid_t suid){
|
|||||||
// - Since ksu maanger app uid is excluded in allow_list_arr, so ksu_uid_should_umount(manager_uid)
|
// - Since ksu maanger app uid is excluded in allow_list_arr, so ksu_uid_should_umount(manager_uid)
|
||||||
// will always return true, that's why we need to explicitly check if new_uid belongs to
|
// will always return true, that's why we need to explicitly check if new_uid belongs to
|
||||||
// ksu manager
|
// ksu manager
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
|
||||||
if (ksu_get_manager_uid() == new_uid % 100000) {
|
if (ksu_get_manager_uid() == new_uid % 100000) {
|
||||||
pr_info("install fd for manager: %d\n", new_uid);
|
pr_info("install fd for manager: %d\n", new_uid);
|
||||||
ksu_install_fd();
|
ksu_install_fd();
|
||||||
@@ -264,6 +265,21 @@ int ksu_handle_setresuid(uid_t ruid, uid_t euid, uid_t suid){
|
|||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (ksu_is_allow_uid_for_current(new_uid)) {
|
||||||
|
spin_lock_irq(¤t->sighand->siglock);
|
||||||
|
disable_seccomp();
|
||||||
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
|
|
||||||
|
if (ksu_get_manager_uid() == new_uid) {
|
||||||
|
pr_info("install fd for ksu manager(uid=%d)\n",
|
||||||
|
new_uid);
|
||||||
|
ksu_install_fd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check if spawned process is normal user app and needs to be umounted
|
// Check if spawned process is normal user app and needs to be umounted
|
||||||
if (likely(is_zygote_normal_app_uid(new_uid) && ksu_uid_should_umount(new_uid))) {
|
if (likely(is_zygote_normal_app_uid(new_uid) && ksu_uid_should_umount(new_uid))) {
|
||||||
@@ -274,7 +290,7 @@ int ksu_handle_setresuid(uid_t ruid, uid_t euid, uid_t suid){
|
|||||||
if (unlikely(is_some_system_uid(new_uid) && susfs_is_umount_for_zygote_system_process_enabled)) {
|
if (unlikely(is_some_system_uid(new_uid) && susfs_is_umount_for_zygote_system_process_enabled)) {
|
||||||
goto do_umount;
|
goto do_umount;
|
||||||
}
|
}
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
|
||||||
if (ksu_is_allow_uid_for_current(new_uid)) {
|
if (ksu_is_allow_uid_for_current(new_uid)) {
|
||||||
if (current->seccomp.mode == SECCOMP_MODE_FILTER &&
|
if (current->seccomp.mode == SECCOMP_MODE_FILTER &&
|
||||||
current->seccomp.filter) {
|
current->seccomp.filter) {
|
||||||
@@ -283,6 +299,7 @@ int ksu_handle_setresuid(uid_t ruid, uid_t euid, uid_t suid){
|
|||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user