ptrace.c (a5a64498c194c82ecad3a2d67cff6231cda8d3dd) | ptrace.c (76aac0e9a17742e60d408be1a706e9aaad370891) |
---|---|
1/* 2 * linux/kernel/ptrace.c 3 * 4 * (C) Copyright 1999 Linus Torvalds 5 * 6 * Common interfaces for "ptrace()" which we do not want 7 * to continually duplicate across every architecture. 8 */ --- 109 unchanged lines hidden (view full) --- 118 /* May we inspect the given task? 119 * This check is used both for attaching with ptrace 120 * and for allowing access to sensitive information in /proc. 121 * 122 * ptrace_attach denies several cases that /proc allows 123 * because setting up the necessary parent/child relationship 124 * or halting the specified task is impossible. 125 */ | 1/* 2 * linux/kernel/ptrace.c 3 * 4 * (C) Copyright 1999 Linus Torvalds 5 * 6 * Common interfaces for "ptrace()" which we do not want 7 * to continually duplicate across every architecture. 8 */ --- 109 unchanged lines hidden (view full) --- 118 /* May we inspect the given task? 119 * This check is used both for attaching with ptrace 120 * and for allowing access to sensitive information in /proc. 121 * 122 * ptrace_attach denies several cases that /proc allows 123 * because setting up the necessary parent/child relationship 124 * or halting the specified task is impossible. 125 */ |
126 uid_t uid; 127 gid_t gid; |
|
126 int dumpable = 0; 127 /* Don't let security modules deny introspection */ 128 if (task == current) 129 return 0; | 128 int dumpable = 0; 129 /* Don't let security modules deny introspection */ 130 if (task == current) 131 return 0; |
130 if (((current->uid != task->euid) || 131 (current->uid != task->suid) || 132 (current->uid != task->uid) || 133 (current->gid != task->egid) || 134 (current->gid != task->sgid) || 135 (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE)) | 132 current_uid_gid(&uid, &gid); 133 if ((uid != task->euid || 134 uid != task->suid || 135 uid != task->uid || 136 gid != task->egid || 137 gid != task->sgid || 138 gid != task->gid) && !capable(CAP_SYS_PTRACE)) |
136 return -EPERM; 137 smp_rmb(); 138 if (task->mm) 139 dumpable = get_dumpable(task->mm); 140 if (!dumpable && !capable(CAP_SYS_PTRACE)) 141 return -EPERM; 142 143 return security_ptrace_may_access(task, mode); --- 569 unchanged lines hidden --- | 139 return -EPERM; 140 smp_rmb(); 141 if (task->mm) 142 dumpable = get_dumpable(task->mm); 143 if (!dumpable && !capable(CAP_SYS_PTRACE)) 144 return -EPERM; 145 146 return security_ptrace_may_access(task, mode); --- 569 unchanged lines hidden --- |