Skip to content

Commit b222853

Browse files
committed
1
for: tiann#3378 ximi-mojito-test/mojito_krenol@d961afa [ 72.716077] KernelSU: task_alloc: uid: 10204 pid: 5188 [ 72.716516] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5576 comm: com.termux [ 72.718024] KernelSU: task_alloc: uid: 10204 pid: 5188 [ 72.718604] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5576 comm: com.termux [ 72.733396] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.734067] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5580 comm: login [ 72.762384] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.764152] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5581 comm: login [ 72.769936] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.770506] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5582 comm: login [ 72.777585] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.779238] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.782688] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5584 comm: login [ 72.792786] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.795331] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 72.796197] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5586 comm: login [ 72.810608] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5586 comm: bash [ 72.820124] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5576 comm: login [ 72.845099] KernelSU: task_alloc: uid: 10204 pid: 5188 [ 72.854435] KernelSU: task_alloc: uid: 10204 pid: 5568 [ 72.877155] KernelSU: task_alloc: uid: 10204 pid: 5188 [ 73.142322] KernelSU: task_alloc: uid: 10204 pid: 5546 [ 73.318306] KernelSU: task_alloc: uid: 10204 pid: 5188 [ 73.324878] KernelSU: task_alloc: uid: 10204 pid: 5600 [ 77.861947] KernelSU: task_alloc: uid: 10204 pid: 5576 [ 77.865438] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5619 comm: bash [ 77.870812] KernelSU: faccessat su->sh! [ 77.870877] KernelSU: faccessat su->sh! [ 77.871118] KernelSU: sys_execve su->ksud! [ 77.871199] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5619 comm: sh [ 77.876575] KernelSU: sys_reboot: intercepted call! magic: 0xdeadbeef id: -889275714 [ 77.876581] KernelSU: ksu fd installed: 3 for pid 5619 [ 77.876582] KernelSU: [5619] install ksu fd: 3 [ 77.876671] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5619 comm: ksud [ 77.877275] KernelSU: ksu fd released [ 81.746578] KernelSU: task_alloc: uid: 0 pid: 5619 [ 81.747869] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5709 comm: sh [ 87.314972] KernelSU: task_alloc: uid: 0 pid: 5619 [ 87.316569] KernelSU: ksu_bprm_check: ksu managed task found with pid: 5721 comm: sh
1 parent f9b2e86 commit b222853

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

kernel/hook/core_hook.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ LSM_HANDLER_TYPE ksu_file_permission(struct file *file, int mask)
107107
return 0;
108108
}
109109

110+
LSM_HANDLER_TYPE ksu_task_alloc(struct task_struct *p, unsigned long clone_flags)
111+
{
112+
struct mount_entry *entry;
113+
kuid_t child_uid = p->cred->uid; // new uid beuing prepped
114+
115+
if (unlikely(ksu_is_allow_uid_for_current(child_uid.val))) {
116+
pr_info("task_alloc: uid: %d pid: %d\n", child_uid.val, p->pid);
117+
set_ti_thread_flag(task_thread_info(p), TIF_KSU_MANAGED);
118+
}
119+
120+
return 0;
121+
}
122+
110123
#ifdef CONFIG_KSU_LSM_SECURITY_HOOKS
111124
static int ksu_inode_rename(struct inode *old_inode, struct dentry *old_dentry,
112125
struct inode *new_inode, struct dentry *new_dentry)
@@ -125,6 +138,8 @@ static struct security_hook_list ksu_hooks[] = {
125138
LSM_HOOK_INIT(inode_rename, ksu_inode_rename),
126139
LSM_HOOK_INIT(task_fix_setuid, ksu_task_fix_setuid),
127140
LSM_HOOK_INIT(bprm_check_security, ksu_bprm_check),
141+
LSM_HOOK_INIT(task_alloc, ksu_task_alloc),
142+
128143
#if !defined(CONFIG_KSU_TAMPER_SYSCALL_TABLE) && !defined(CONFIG_KSU_KPROBES_KSUD)
129144
LSM_HOOK_INIT(file_permission, ksu_file_permission),
130145
#endif

0 commit comments

Comments
 (0)