[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110925174622.GA18509@redhat.com>
Date: Sun, 25 Sep 2011 19:46:22 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Matt Fleming <matt@...sole-pimps.org>,
Tejun Heo <htejun@...il.com>, linux-kernel@...r.kernel.org
Subject: [PATCH for 3.1] ptrace: PTRACE_LISTEN forgets to unlock ->siglock
If PTRACE_LISTEN fails after lock_task_sighand() it doesn't drop ->siglock.
Reported-by: Matt Fleming <matt.fleming@...el.com>
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
kernel/ptrace.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
--- 3.1/kernel/ptrace.c~1_PTRACE_LISTEN_siglock 2011-09-25 19:14:32.000000000 +0200
+++ 3.1/kernel/ptrace.c 2011-09-25 19:40:57.000000000 +0200
@@ -744,20 +744,17 @@ int ptrace_request(struct task_struct *c
break;
si = child->last_siginfo;
- if (unlikely(!si || si->si_code >> 8 != PTRACE_EVENT_STOP))
- break;
-
- child->jobctl |= JOBCTL_LISTENING;
-
- /*
- * If NOTIFY is set, it means event happened between start
- * of this trap and now. Trigger re-trap immediately.
- */
- if (child->jobctl & JOBCTL_TRAP_NOTIFY)
- signal_wake_up(child, true);
-
+ if (likely(si && (si->si_code >> 8) == PTRACE_EVENT_STOP)) {
+ child->jobctl |= JOBCTL_LISTENING;
+ /*
+ * If NOTIFY is set, it means event happened between
+ * start of this trap and now. Trigger re-trap.
+ */
+ if (child->jobctl & JOBCTL_TRAP_NOTIFY)
+ signal_wake_up(child, true);
+ ret = 0;
+ }
unlock_task_sighand(child, &flags);
- ret = 0;
break;
case PTRACE_DETACH: /* detach a process that was attached. */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists