Lines Matching refs:task
174 static int get_task_root(struct task_struct *task, struct path *root) in get_task_root() argument
178 task_lock(task); in get_task_root()
179 if (task->fs) { in get_task_root()
180 get_fs_root(task->fs, root); in get_task_root()
183 task_unlock(task); in get_task_root()
189 struct task_struct *task = get_proc_task(d_inode(dentry)); in proc_cwd_link() local
192 if (task) { in proc_cwd_link()
193 task_lock(task); in proc_cwd_link()
194 if (task->fs) { in proc_cwd_link()
195 get_fs_pwd(task->fs, path); in proc_cwd_link()
198 task_unlock(task); in proc_cwd_link()
199 put_task_struct(task); in proc_cwd_link()
206 struct task_struct *task = get_proc_task(d_inode(dentry)); in proc_root_link() local
209 if (task) { in proc_root_link()
210 result = get_task_root(task, path); in proc_root_link()
211 put_task_struct(task); in proc_root_link()
399 struct pid *pid, struct task_struct *task) in proc_pid_wchan() argument
404 if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) in proc_pid_wchan()
407 wchan = get_wchan(task); in proc_pid_wchan()
419 static int lock_trace(struct task_struct *task) in lock_trace() argument
421 int err = down_read_killable(&task->signal->exec_update_lock); in lock_trace()
424 if (!ptrace_may_access(task, PTRACE_MODE_ATTACH_FSCREDS)) { in lock_trace()
425 up_read(&task->signal->exec_update_lock); in lock_trace()
431 static void unlock_trace(struct task_struct *task) in unlock_trace() argument
433 up_read(&task->signal->exec_update_lock); in unlock_trace()
441 struct pid *pid, struct task_struct *task) in proc_pid_stack() argument
465 err = lock_trace(task); in proc_pid_stack()
469 nr_entries = stack_trace_save_tsk(task, entries, in proc_pid_stack()
476 unlock_trace(task); in proc_pid_stack()
489 struct pid *pid, struct task_struct *task) in proc_pid_schedstat() argument
495 (unsigned long long)task->se.sum_exec_runtime, in proc_pid_schedstat()
496 (unsigned long long)task->sched_info.run_delay, in proc_pid_schedstat()
497 task->sched_info.pcount); in proc_pid_schedstat()
508 struct task_struct *task = get_proc_task(inode); in lstats_show_proc() local
510 if (!task) in lstats_show_proc()
514 struct latency_record *lr = &task->latency_record[i]; in lstats_show_proc()
530 put_task_struct(task); in lstats_show_proc()
542 struct task_struct *task = get_proc_task(file_inode(file)); in lstats_write() local
544 if (!task) in lstats_write()
546 clear_tsk_latency_tracing(task); in lstats_write()
547 put_task_struct(task); in lstats_write()
563 struct pid *pid, struct task_struct *task) in proc_oom_score() argument
569 badness = oom_badness(task, totalpages); in proc_oom_score()
609 struct pid *pid, struct task_struct *task) in proc_pid_limits() argument
616 if (!lock_task_sighand(task, &flags)) in proc_pid_limits()
618 memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS); in proc_pid_limits()
619 unlock_task_sighand(task, &flags); in proc_pid_limits()
653 struct pid *pid, struct task_struct *task) in proc_pid_syscall() argument
659 res = lock_trace(task); in proc_pid_syscall()
663 if (task_current_syscall(task, &info)) in proc_pid_syscall()
674 unlock_trace(task); in proc_pid_syscall()
687 struct task_struct *task; in proc_fd_access_allowed() local
693 task = get_proc_task(inode); in proc_fd_access_allowed()
694 if (task) { in proc_fd_access_allowed()
695 allowed = ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS); in proc_fd_access_allowed()
696 put_task_struct(task); in proc_fd_access_allowed()
724 struct task_struct *task, in has_pid_permissions() argument
733 return ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS); in has_pid_permissions()
739 return ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS); in has_pid_permissions()
747 struct task_struct *task; in proc_pid_permission() local
750 task = get_proc_task(inode); in proc_pid_permission()
751 if (!task) in proc_pid_permission()
753 has_perms = has_pid_permissions(fs_info, task, HIDEPID_NO_ACCESS); in proc_pid_permission()
754 put_task_struct(task); in proc_pid_permission()
783 struct task_struct *task; in proc_single_show() local
786 task = get_pid_task(pid, PIDTYPE_PID); in proc_single_show()
787 if (!task) in proc_single_show()
790 ret = PROC_I(inode)->op.proc_show(m, ns, pid, task); in proc_single_show()
792 put_task_struct(task); in proc_single_show()
811 struct task_struct *task = get_proc_task(inode); in proc_mem_open() local
814 if (task) { in proc_mem_open()
815 mm = mm_access(task, mode | PTRACE_MODE_FSCREDS); in proc_mem_open()
816 put_task_struct(task); in proc_mem_open()
1054 struct task_struct *task = get_proc_task(file_inode(file)); in oom_adj_read() local
1059 if (!task) in oom_adj_read()
1061 if (task->signal->oom_score_adj == OOM_SCORE_ADJ_MAX) in oom_adj_read()
1064 oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) / in oom_adj_read()
1066 put_task_struct(task); in oom_adj_read()
1076 struct task_struct *task; in __set_oom_adj() local
1079 task = get_proc_task(file_inode(file)); in __set_oom_adj()
1080 if (!task) in __set_oom_adj()
1085 if (oom_adj < task->signal->oom_score_adj && in __set_oom_adj()
1095 current->comm, task_pid_nr(current), task_pid_nr(task), in __set_oom_adj()
1096 task_pid_nr(task)); in __set_oom_adj()
1098 if ((short)oom_adj < task->signal->oom_score_adj_min && in __set_oom_adj()
1110 if (!task->vfork_done) { in __set_oom_adj()
1111 struct task_struct *p = find_lock_task_mm(task); in __set_oom_adj()
1122 task->signal->oom_score_adj = oom_adj; in __set_oom_adj()
1124 task->signal->oom_score_adj_min = (short)oom_adj; in __set_oom_adj()
1125 trace_oom_score_adj_update(task); in __set_oom_adj()
1132 if (same_thread_group(task, p)) in __set_oom_adj()
1152 put_task_struct(task); in __set_oom_adj()
1213 struct task_struct *task = get_proc_task(file_inode(file)); in oom_score_adj_read() local
1218 if (!task) in oom_score_adj_read()
1220 oom_score_adj = task->signal->oom_score_adj; in oom_score_adj_read()
1221 put_task_struct(task); in oom_score_adj_read()
1267 struct task_struct *task = get_proc_task(inode); in proc_loginuid_read() local
1271 if (!task) in proc_loginuid_read()
1275 audit_get_loginuid(task))); in proc_loginuid_read()
1276 put_task_struct(task); in proc_loginuid_read()
1333 struct task_struct *task = get_proc_task(inode); in proc_sessionid_read() local
1337 if (!task) in proc_sessionid_read()
1340 audit_get_sessionid(task)); in proc_sessionid_read()
1341 put_task_struct(task); in proc_sessionid_read()
1355 struct task_struct *task = get_proc_task(file_inode(file)); in proc_fault_inject_read() local
1360 if (!task) in proc_fault_inject_read()
1362 make_it_fail = task->make_it_fail; in proc_fault_inject_read()
1363 put_task_struct(task); in proc_fault_inject_read()
1373 struct task_struct *task; in proc_fault_inject_write() local
1391 task = get_proc_task(file_inode(file)); in proc_fault_inject_write()
1392 if (!task) in proc_fault_inject_write()
1394 task->make_it_fail = make_it_fail; in proc_fault_inject_write()
1395 put_task_struct(task); in proc_fault_inject_write()
1409 struct task_struct *task; in proc_fail_nth_write() local
1417 task = get_proc_task(file_inode(file)); in proc_fail_nth_write()
1418 if (!task) in proc_fail_nth_write()
1420 task->fail_nth = n; in proc_fail_nth_write()
1421 put_task_struct(task); in proc_fail_nth_write()
1429 struct task_struct *task; in proc_fail_nth_read() local
1433 task = get_proc_task(file_inode(file)); in proc_fail_nth_read()
1434 if (!task) in proc_fail_nth_read()
1436 len = snprintf(numbuf, sizeof(numbuf), "%u\n", task->fail_nth); in proc_fail_nth_read()
1437 put_task_struct(task); in proc_fail_nth_read()
1737 struct task_struct *task; in proc_exe_link() local
1740 task = get_proc_task(d_inode(dentry)); in proc_exe_link()
1741 if (!task) in proc_exe_link()
1743 exe_file = get_task_exe_file(task); in proc_exe_link()
1744 put_task_struct(task); in proc_exe_link()
1830 void task_dump_owner(struct task_struct *task, umode_t mode, in task_dump_owner() argument
1840 if (unlikely(task->flags & PF_KTHREAD)) { in task_dump_owner()
1848 cred = __task_cred(task); in task_dump_owner()
1863 task_lock(task); in task_dump_owner()
1864 mm = task->mm; in task_dump_owner()
1882 task_unlock(task); in task_dump_owner()
1902 struct task_struct *task, umode_t mode) in proc_pid_make_inode() argument
1924 pid = get_task_pid(task, PIDTYPE_PID); in proc_pid_make_inode()
1931 task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid); in proc_pid_make_inode()
1932 security_task_to_inode(task, inode); in proc_pid_make_inode()
1955 struct task_struct *task, umode_t mode) in proc_pid_make_base_inode() argument
1961 inode = proc_pid_make_inode(sb, task, mode); in proc_pid_make_base_inode()
1980 struct task_struct *task; in pid_getattr() local
1987 task = pid_task(proc_pid(inode), PIDTYPE_PID); in pid_getattr()
1988 if (task) { in pid_getattr()
1989 if (!has_pid_permissions(fs_info, task, HIDEPID_INVISIBLE)) { in pid_getattr()
1997 task_dump_owner(task, inode->i_mode, &stat->uid, &stat->gid); in pid_getattr()
2008 void pid_update_inode(struct task_struct *task, struct inode *inode) in pid_update_inode() argument
2010 task_dump_owner(task, inode->i_mode, &inode->i_uid, &inode->i_gid); in pid_update_inode()
2013 security_task_to_inode(task, inode); in pid_update_inode()
2024 struct task_struct *task; in pid_revalidate() local
2030 task = get_proc_task(inode); in pid_revalidate()
2032 if (task) { in pid_revalidate()
2033 pid_update_inode(task, inode); in pid_revalidate()
2034 put_task_struct(task); in pid_revalidate()
2076 instantiate_t instantiate, struct task_struct *task, const void *ptr) in proc_fill_cache() argument
2092 res = instantiate(child, task, ptr); in proc_fill_cache()
2157 struct task_struct *task; in map_files_d_revalidate() local
2165 task = get_proc_task(inode); in map_files_d_revalidate()
2166 if (!task) in map_files_d_revalidate()
2169 mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); in map_files_d_revalidate()
2185 task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid); in map_files_d_revalidate()
2187 security_task_to_inode(task, inode); in map_files_d_revalidate()
2192 put_task_struct(task); in map_files_d_revalidate()
2207 struct task_struct *task; in map_files_get_link() local
2212 task = get_proc_task(d_inode(dentry)); in map_files_get_link()
2213 if (!task) in map_files_get_link()
2216 mm = get_task_mm(task); in map_files_get_link()
2217 put_task_struct(task); in map_files_get_link()
2277 struct task_struct *task, const void *ptr) in proc_map_files_instantiate() argument
2283 inode = proc_pid_make_inode(dentry->d_sb, task, S_IFLNK | in proc_map_files_instantiate()
2304 struct task_struct *task; in proc_map_files_lookup() local
2309 task = get_proc_task(dir); in proc_map_files_lookup()
2310 if (!task) in proc_map_files_lookup()
2314 if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) in proc_map_files_lookup()
2321 mm = get_task_mm(task); in proc_map_files_lookup()
2335 result = proc_map_files_instantiate(dentry, task, in proc_map_files_lookup()
2343 put_task_struct(task); in proc_map_files_lookup()
2358 struct task_struct *task; in proc_map_files_readdir() local
2369 task = get_proc_task(file_inode(file)); in proc_map_files_readdir()
2370 if (!task) in proc_map_files_readdir()
2374 if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) in proc_map_files_readdir()
2381 mm = get_task_mm(task); in proc_map_files_readdir()
2435 task, in proc_map_files_readdir()
2442 put_task_struct(task); in proc_map_files_readdir()
2457 struct task_struct *task; member
2467 tp->task = get_pid_task(tp->pid, PIDTYPE_PID); in timers_start()
2468 if (!tp->task) in timers_start()
2471 tp->sighand = lock_task_sighand(tp->task, &tp->flags); in timers_start()
2475 return seq_list_start(&tp->task->signal->posix_timers, *pos); in timers_start()
2481 return seq_list_next(v, &tp->task->signal->posix_timers, pos); in timers_next()
2489 unlock_task_sighand(tp->task, &tp->flags); in timers_stop()
2493 if (tp->task) { in timers_stop()
2494 put_task_struct(tp->task); in timers_stop()
2495 tp->task = NULL; in timers_stop()
2648 struct task_struct *task, const void *ptr) in proc_pident_instantiate() argument
2654 inode = proc_pid_make_inode(dentry->d_sb, task, p->mode); in proc_pident_instantiate()
2666 pid_update_inode(task, inode); in proc_pident_instantiate()
2676 struct task_struct *task = get_proc_task(dir); in proc_pident_lookup() local
2679 if (!task) in proc_pident_lookup()
2690 res = proc_pident_instantiate(dentry, task, p); in proc_pident_lookup()
2694 put_task_struct(task); in proc_pident_lookup()
2702 struct task_struct *task = get_proc_task(file_inode(file)); in proc_pident_readdir() local
2705 if (!task) in proc_pident_readdir()
2716 proc_pident_instantiate, task, p)) in proc_pident_readdir()
2721 put_task_struct(task); in proc_pident_readdir()
2739 struct task_struct *task = get_proc_task(inode); in proc_pid_attr_read() local
2741 if (!task) in proc_pid_attr_read()
2744 length = security_getprocattr(task, PROC_I(inode)->op.lsm, in proc_pid_attr_read()
2747 put_task_struct(task); in proc_pid_attr_read()
2758 struct task_struct *task; in proc_pid_attr_write() local
2767 task = pid_task(proc_pid(inode), PIDTYPE_PID); in proc_pid_attr_write()
2768 if (!task) { in proc_pid_attr_write()
2773 if (current != task) { in proc_pid_attr_write()
2914 struct task_struct *task = get_proc_task(file_inode(file)); in proc_coredump_filter_read() local
2920 if (!task) in proc_coredump_filter_read()
2924 mm = get_task_mm(task); in proc_coredump_filter_read()
2933 put_task_struct(task); in proc_coredump_filter_read()
2943 struct task_struct *task; in proc_coredump_filter_write() local
2955 task = get_proc_task(file_inode(file)); in proc_coredump_filter_write()
2956 if (!task) in proc_coredump_filter_write()
2959 mm = get_task_mm(task); in proc_coredump_filter_write()
2973 put_task_struct(task); in proc_coredump_filter_write()
2988 static int do_io_accounting(struct task_struct *task, struct seq_file *m, int whole) in do_io_accounting() argument
2990 struct task_io_accounting acct = task->ioac; in do_io_accounting()
2994 result = down_read_killable(&task->signal->exec_update_lock); in do_io_accounting()
2998 if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) { in do_io_accounting()
3003 if (whole && lock_task_sighand(task, &flags)) { in do_io_accounting()
3004 struct task_struct *t = task; in do_io_accounting()
3006 task_io_accounting_add(&acct, &task->signal->ioac); in do_io_accounting()
3007 while_each_thread(task, t) in do_io_accounting()
3010 unlock_task_sighand(task, &flags); in do_io_accounting()
3030 up_read(&task->signal->exec_update_lock); in do_io_accounting()
3035 struct pid *pid, struct task_struct *task) in proc_tid_io_accounting() argument
3037 return do_io_accounting(task, m, 0); in proc_tid_io_accounting()
3041 struct pid *pid, struct task_struct *task) in proc_tgid_io_accounting() argument
3043 return do_io_accounting(task, m, 1); in proc_tgid_io_accounting()
3052 struct task_struct *task; in proc_id_map_open() local
3056 task = get_proc_task(inode); in proc_id_map_open()
3057 if (task) { in proc_id_map_open()
3059 ns = get_user_ns(task_cred_xxx(task, user_ns)); in proc_id_map_open()
3061 put_task_struct(task); in proc_id_map_open()
3130 struct task_struct *task; in proc_setgroups_open() local
3134 task = get_proc_task(inode); in proc_setgroups_open()
3135 if (task) { in proc_setgroups_open()
3137 ns = get_user_ns(task_cred_xxx(task, user_ns)); in proc_setgroups_open()
3139 put_task_struct(task); in proc_setgroups_open()
3180 struct pid *pid, struct task_struct *task) in proc_pid_personality() argument
3182 int err = lock_trace(task); in proc_pid_personality()
3184 seq_printf(m, "%08x\n", task->personality); in proc_pid_personality()
3185 unlock_trace(task); in proc_pid_personality()
3192 struct pid *pid, struct task_struct *task) in proc_pid_patch_state() argument
3194 seq_printf(m, "%d\n", task->patch_state); in proc_pid_patch_state()
3201 struct pid *pid, struct task_struct *task) in proc_pid_ksm_merging_pages() argument
3205 mm = get_task_mm(task); in proc_pid_ksm_merging_pages()
3214 struct pid *pid, struct task_struct *task) in proc_pid_ksm_stat() argument
3218 mm = get_task_mm(task); in proc_pid_ksm_stat()
3230 struct pid *pid, struct task_struct *task) in proc_stack_depth() argument
3233 (task->prev_lowest_stack & (THREAD_SIZE - 1)); in proc_stack_depth()
3235 (task->lowest_stack & (THREAD_SIZE - 1)); in proc_stack_depth()
3427 struct task_struct *task, const void *ptr) in proc_pid_instantiate() argument
3431 inode = proc_pid_make_base_inode(dentry->d_sb, task, in proc_pid_instantiate()
3441 pid_update_inode(task, inode); in proc_pid_instantiate()
3449 struct task_struct *task; in proc_pid_lookup() local
3462 task = find_task_by_pid_ns(tgid, ns); in proc_pid_lookup()
3463 if (task) in proc_pid_lookup()
3464 get_task_struct(task); in proc_pid_lookup()
3466 if (!task) in proc_pid_lookup()
3471 if (!has_pid_permissions(fs_info, task, HIDEPID_NO_ACCESS)) in proc_pid_lookup()
3475 result = proc_pid_instantiate(dentry, task, NULL); in proc_pid_lookup()
3477 put_task_struct(task); in proc_pid_lookup()
3488 struct task_struct *task; member
3494 if (iter.task) in next_tgid()
3495 put_task_struct(iter.task); in next_tgid()
3498 iter.task = NULL; in next_tgid()
3502 iter.task = pid_task(pid, PIDTYPE_TGID); in next_tgid()
3503 if (!iter.task) { in next_tgid()
3507 get_task_struct(iter.task); in next_tgid()
3539 iter.task = NULL; in proc_pid_readdir()
3541 iter.task; in proc_pid_readdir()
3547 if (!has_pid_permissions(fs_info, iter.task, HIDEPID_INVISIBLE)) in proc_pid_readdir()
3553 proc_pid_instantiate, iter.task, NULL)) { in proc_pid_readdir()
3554 put_task_struct(iter.task); in proc_pid_readdir()
3578 struct task_struct *task; in proc_tid_comm_permission() local
3580 task = get_proc_task(inode); in proc_tid_comm_permission()
3581 if (!task) in proc_tid_comm_permission()
3583 is_same_tgroup = same_thread_group(current, task); in proc_tid_comm_permission()
3584 put_task_struct(task); in proc_tid_comm_permission()
3736 struct task_struct *task, const void *ptr) in proc_task_instantiate() argument
3739 inode = proc_pid_make_base_inode(dentry->d_sb, task, in proc_task_instantiate()
3749 pid_update_inode(task, inode); in proc_task_instantiate()
3757 struct task_struct *task; in proc_task_lookup() local
3774 task = find_task_by_pid_ns(tid, ns); in proc_task_lookup()
3775 if (task) in proc_task_lookup()
3776 get_task_struct(task); in proc_task_lookup()
3778 if (!task) in proc_task_lookup()
3780 if (!same_thread_group(leader, task)) in proc_task_lookup()
3783 result = proc_task_instantiate(dentry, task, NULL); in proc_task_lookup()
3785 put_task_struct(task); in proc_task_lookup()
3807 struct task_struct *pos, *task; in first_tid() local
3814 task = pid_task(pid, PIDTYPE_PID); in first_tid()
3815 if (!task) in first_tid()
3821 if (pos && same_thread_group(pos, task)) in first_tid()
3826 if (nr >= get_nr_threads(task)) in first_tid()
3832 pos = task = task->group_leader; in first_tid()
3836 } while_each_thread(task, pos); in first_tid()
3873 struct task_struct *task; in proc_task_readdir() local
3889 for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); in proc_task_readdir()
3890 task; in proc_task_readdir()
3891 task = next_tid(task), ctx->pos++) { in proc_task_readdir()
3895 tid = task_pid_nr_ns(task, ns); in proc_task_readdir()
3900 proc_task_instantiate, task, NULL)) { in proc_task_readdir()
3904 put_task_struct(task); in proc_task_readdir()