[PATCH] CRED: ptrace_attach() should use the target process's mutex

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <jmorris@...>
Cc: <dhowells@...>, <penguin-kernel@...>, <serue@...>, <haradats@...>, <k.takeda26@...>, <linux-security-module@...>, <linux-kernel@...>
Date: Wednesday, October 1, 2008 - 11:38 am

ptrace_attach() should use the target process's mutex when attaching to it,
not the current (tracer) process's mutex.

Signed-off-by: David Howells
---

kernel/ptrace.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 893a099..2ee343a 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -174,7 +174,7 @@ int ptrace_attach(struct task_struct *task)
/* Protect exec's credential calculations against our interference;
* SUID, SGID and LSM creds get determined differently under ptrace.
*/
- retval = mutex_lock_interruptible(&current->cred_exec_mutex);
+ retval = mutex_lock_interruptible(&task->cred_exec_mutex);
if (retval < 0)
goto out;

@@ -218,7 +218,7 @@ repeat:
bad:
write_unlock_irqrestore(&tasklist_lock, flags);
task_unlock(task);
- mutex_unlock(&current->cred_exec_mutex);
+ mutex_unlock(&task->cred_exec_mutex);
out:
return retval;
}

--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] CRED: ptrace_attach() should use the target process'..., David Howells, (Wed Oct 1, 11:38 am)