diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:12 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:12 -0500 |
commit | 76aac0e9a17742e60d408be1a706e9aaad370891 (patch) | |
tree | e873a000d9c96209726e0958e311f005c13b2ed5 /kernel/ptrace.c | |
parent | b103c59883f1ec6e4d548b25054608cb5724453c (diff) |
CRED: Wrap task credential accesses in the core kernel
Wrap access to task credentials so that they can be separated more easily from
the task_struct during the introduction of COW creds.
Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().
Change some task->e?[ug]id to task_e?[ug]id(). In some places it makes more
sense to use RCU directly rather than a convenient wrapper; these will be
addressed by later patches.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-audit@redhat.com
Cc: containers@lists.linux-foundation.org
Cc: linux-mm@kvack.org
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r-- | kernel/ptrace.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 1e68e4c39e2c..937f6b5b2008 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -123,16 +123,19 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode) | |||
123 | * because setting up the necessary parent/child relationship | 123 | * because setting up the necessary parent/child relationship |
124 | * or halting the specified task is impossible. | 124 | * or halting the specified task is impossible. |
125 | */ | 125 | */ |
126 | uid_t uid; | ||
127 | gid_t gid; | ||
126 | int dumpable = 0; | 128 | int dumpable = 0; |
127 | /* Don't let security modules deny introspection */ | 129 | /* Don't let security modules deny introspection */ |
128 | if (task == current) | 130 | if (task == current) |
129 | return 0; | 131 | return 0; |
130 | if (((current->uid != task->euid) || | 132 | current_uid_gid(&uid, &gid); |
131 | (current->uid != task->suid) || | 133 | if ((uid != task->euid || |
132 | (current->uid != task->uid) || | 134 | uid != task->suid || |
133 | (current->gid != task->egid) || | 135 | uid != task->uid || |
134 | (current->gid != task->sgid) || | 136 | gid != task->egid || |
135 | (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE)) | 137 | gid != task->sgid || |
138 | gid != task->gid) && !capable(CAP_SYS_PTRACE)) | ||
136 | return -EPERM; | 139 | return -EPERM; |
137 | smp_rmb(); | 140 | smp_rmb(); |
138 | if (task->mm) | 141 | if (task->mm) |