* [PATCH] ptrace: don't take tasklist to get/set ->last_siginfo
@ 2009-05-28 8:21 Oleg Nesterov
2009-05-28 19:31 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2009-05-28 8:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Roland McGrath, linux-kernel
Change ptrace_getsiginfo/ptrace_setsiginfo to use lock_task_sighand()
without tasklist_lock. Perhaps it makes sense to make a singler helper
with "bool rw" argument.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
--- PTRACE/kernel/ptrace.c~SIGINFO 2009-05-28 10:03:01.000000000 +0200
+++ PTRACE/kernel/ptrace.c 2009-05-28 10:06:59.000000000 +0200
@@ -463,37 +463,33 @@ static int ptrace_setoptions
static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info)
{
+ unsigned long flags;
int error = -ESRCH;
- read_lock(&tasklist_lock);
- if (likely(child->sighand != NULL)) {
+ if (lock_task_sighand(child, &flags)) {
error = -EINVAL;
- spin_lock_irq(&child->sighand->siglock);
if (likely(child->last_siginfo != NULL)) {
*info = *child->last_siginfo;
error = 0;
}
- spin_unlock_irq(&child->sighand->siglock);
+ unlock_task_sighand(child, &flags);
}
- read_unlock(&tasklist_lock);
return error;
}
static int ptrace_setsiginfo(struct task_struct *child, const siginfo_t *info)
{
+ unsigned long flags;
int error = -ESRCH;
- read_lock(&tasklist_lock);
- if (likely(child->sighand != NULL)) {
+ if (lock_task_sighand(child, &flags)) {
error = -EINVAL;
- spin_lock_irq(&child->sighand->siglock);
if (likely(child->last_siginfo != NULL)) {
*child->last_siginfo = *info;
error = 0;
}
- spin_unlock_irq(&child->sighand->siglock);
+ unlock_task_sighand(child, &flags);
}
- read_unlock(&tasklist_lock);
return error;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-28 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 8:21 [PATCH] ptrace: don't take tasklist to get/set ->last_siginfo Oleg Nesterov
2009-05-28 19:31 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox