aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-05-08 08:55:22 -0400
committerJames Morris <jmorris@namei.org>2009-05-10 18:15:36 -0400
commit5e751e992f3fb08ba35e1ca8095ec8fbf9eda523 (patch)
tree711b1b47622dc9661f1d3d9c67d55c0b21456e8c /kernel
parentd254117099d711f215e62427f55dfb8ebd5ad011 (diff)
CRED: Rename cred_exec_mutex to reflect that it's a guard against ptrace
Rename cred_exec_mutex to reflect that it's a guard against foreign intervention on a process's credential state, such as is made by ptrace(). The attachment of a debugger to a process affects execve()'s calculation of the new credential state - _and_ also setprocattr()'s calculation of that state. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cred.c4
-rw-r--r--kernel/ptrace.c9
2 files changed, 7 insertions, 6 deletions
diff --git a/kernel/cred.c b/kernel/cred.c
index 3a039189d707..1bb4d7e5d616 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -167,7 +167,7 @@ EXPORT_SYMBOL(prepare_creds);
167 167
168/* 168/*
169 * Prepare credentials for current to perform an execve() 169 * Prepare credentials for current to perform an execve()
170 * - The caller must hold current->cred_exec_mutex 170 * - The caller must hold current->cred_guard_mutex
171 */ 171 */
172struct cred *prepare_exec_creds(void) 172struct cred *prepare_exec_creds(void)
173{ 173{
@@ -276,7 +276,7 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
276 struct cred *new; 276 struct cred *new;
277 int ret; 277 int ret;
278 278
279 mutex_init(&p->cred_exec_mutex); 279 mutex_init(&p->cred_guard_mutex);
280 280
281 if ( 281 if (
282#ifdef CONFIG_KEYS 282#ifdef CONFIG_KEYS
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 0692ab5a0d67..27ac80298bfa 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -185,10 +185,11 @@ int ptrace_attach(struct task_struct *task)
185 if (same_thread_group(task, current)) 185 if (same_thread_group(task, current))
186 goto out; 186 goto out;
187 187
188 /* Protect exec's credential calculations against our interference; 188 /* Protect the target's credential calculations against our
189 * SUID, SGID and LSM creds get determined differently under ptrace. 189 * interference; SUID, SGID and LSM creds get determined differently
190 * under ptrace.
190 */ 191 */
191 retval = mutex_lock_interruptible(&task->cred_exec_mutex); 192 retval = mutex_lock_interruptible(&task->cred_guard_mutex);
192 if (retval < 0) 193 if (retval < 0)
193 goto out; 194 goto out;
194 195
@@ -232,7 +233,7 @@ repeat:
232bad: 233bad:
233 write_unlock_irqrestore(&tasklist_lock, flags); 234 write_unlock_irqrestore(&tasklist_lock, flags);
234 task_unlock(task); 235 task_unlock(task);
235 mutex_unlock(&task->cred_exec_mutex); 236 mutex_unlock(&task->cred_guard_mutex);
236out: 237out:
237 return retval; 238 return retval;
238} 239}