Lines Matching refs:task

59 	struct task_struct *task = inode->u.proc_i.task;  in proc_exe_link()  local
61 task_lock(task); in proc_exe_link()
62 mm = task->mm; in proc_exe_link()
65 task_unlock(task); in proc_exe_link()
90 task_lock(inode->u.proc_i.task); in proc_cwd_link()
91 fs = inode->u.proc_i.task->fs; in proc_cwd_link()
94 task_unlock(inode->u.proc_i.task); in proc_cwd_link()
110 task_lock(inode->u.proc_i.task); in proc_root_link()
111 fs = inode->u.proc_i.task->fs; in proc_root_link()
114 task_unlock(inode->u.proc_i.task); in proc_root_link()
126 #define MAY_PTRACE(task) \ argument
127 (task == current || \
128 (task->p_pptr == current && \
129 (task->ptrace & PT_PTRACED) && task->state == TASK_STOPPED))
131 static int may_ptrace_attach(struct task_struct *task) in may_ptrace_attach() argument
135 task_lock(task); in may_ptrace_attach()
137 if (((current->uid != task->euid) || in may_ptrace_attach()
138 (current->uid != task->suid) || in may_ptrace_attach()
139 (current->uid != task->uid) || in may_ptrace_attach()
140 (current->gid != task->egid) || in may_ptrace_attach()
141 (current->gid != task->sgid) || in may_ptrace_attach()
142 (!cap_issubset(task->cap_permitted, current->cap_permitted)) || in may_ptrace_attach()
143 (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE)) in may_ptrace_attach()
146 if (!is_dumpable(task) && !capable(CAP_SYS_PTRACE)) in may_ptrace_attach()
152 task_unlock(task); in may_ptrace_attach()
156 static int proc_pid_environ(struct task_struct *task, char * buffer) in proc_pid_environ() argument
161 if (!may_ptrace_attach(task)) in proc_pid_environ()
164 task_lock(task); in proc_pid_environ()
165 mm = task->mm; in proc_pid_environ()
168 task_unlock(task); in proc_pid_environ()
173 res = access_process_vm(task, mm->env_start, buffer, len, 0); in proc_pid_environ()
174 if (res >= 0 && !may_ptrace_attach(task)) in proc_pid_environ()
182 static int proc_pid_cmdline(struct task_struct *task, char * buffer) in proc_pid_cmdline() argument
186 task_lock(task); in proc_pid_cmdline()
187 mm = task->mm; in proc_pid_cmdline()
194 task_unlock(task); in proc_pid_cmdline()
199 res = access_process_vm(task, mm->arg_start, buffer, len, 0); in proc_pid_cmdline()
211 res += access_process_vm(task, mm->env_start, buffer+res, len, 0); in proc_pid_cmdline()
278 struct task_struct *task = inode->u.proc_i.task; in maps_open() local
282 m->private = task; in maps_open()
297 struct task_struct *task = inode->u.proc_i.task; in mounts_open() local
303 task_lock(task); in mounts_open()
304 namespace = task->namespace; in mounts_open()
307 task_unlock(task); in mounts_open()
343 struct task_struct *task = inode->u.proc_i.task; in proc_info_read() local
351 length = inode->u.proc_i.op.proc_read(task, (char*)page); in proc_info_read()
384 struct task_struct *task = file->f_dentry->d_inode->u.proc_i.task; in mem_read() local
390 if (!MAY_PTRACE(task) || !may_ptrace_attach(task)) in mem_read()
397 task_lock(task); in mem_read()
398 mm = task->mm; in mem_read()
401 task_unlock(task); in mem_read()
417 retval = access_process_vm(task, src, page, this_len, 0); in mem_read()
418 if (!retval || !MAY_PTRACE(task) || !may_ptrace_attach(task)) { in mem_read()
449 struct task_struct *task = file->f_dentry->d_inode->u.proc_i.task; in mem_write() local
452 if (!MAY_PTRACE(task) || !may_ptrace_attach(task)) in mem_write()
467 retval = access_process_vm(task, dst, page, this_len, 1); in mem_write()
636 struct task_struct *p = inode->u.proc_i.task; in proc_readfd()
704 pid = inode->u.proc_i.task->pid; in proc_base_readdir()
739 static int task_dumpable(struct task_struct *task) in task_dumpable() argument
743 task_lock(task); in task_dumpable()
744 retval = is_dumpable(task); in task_dumpable()
745 task_unlock(task); in task_dumpable()
750 static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task, int ino) in proc_pid_make_inode() argument
763 inode->i_ino = fake_ino(task->pid, ino); in proc_pid_make_inode()
765 if (!task->pid) in proc_pid_make_inode()
771 get_task_struct(task); in proc_pid_make_inode()
772 inode->u.proc_i.task = task; in proc_pid_make_inode()
775 if (ino == PROC_PID_INO || task_dumpable(task)) { in proc_pid_make_inode()
776 inode->i_uid = task->euid; in proc_pid_make_inode()
777 inode->i_gid = task->egid; in proc_pid_make_inode()
803 if (dentry->d_inode->u.proc_i.task->pid) in pid_base_revalidate()
837 struct task_struct *task = dir->u.proc_i.task; in proc_lookupfd() local
859 inode = proc_pid_make_inode(dir->i_sb, task, PROC_PID_FD_DIR+fd); in proc_lookupfd()
862 task_lock(task); in proc_lookupfd()
863 files = task->files; in proc_lookupfd()
866 task_unlock(task); in proc_lookupfd()
914 struct task_struct *task = dir->u.proc_i.task; in proc_base_lookup() local
930 inode = proc_pid_make_inode(dir->i_sb, task, p->type); in proc_base_lookup()
1040 struct task_struct *task; in proc_pid_lookup() local
1055 inode->u.proc_i.task = NULL; in proc_pid_lookup()
1077 task = find_task_by_pid(pid); in proc_pid_lookup()
1078 if (task) in proc_pid_lookup()
1079 get_task_struct(task); in proc_pid_lookup()
1081 if (!task) in proc_pid_lookup()
1084 inode = proc_pid_make_inode(dir->i_sb, task, PROC_PID_INO); in proc_pid_lookup()
1086 free_task_struct(task); in proc_pid_lookup()
1107 if (inode->u.proc_i.task) in proc_pid_delete_inode()
1108 free_task_struct(inode->u.proc_i.task); in proc_pid_delete_inode()