diff options
author | Oleg Nesterov <oleg@redhat.com> | 2011-09-25 13:46:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-25 14:02:00 -0400 |
commit | f9d81f61c84aca693bc353dfef4b8c36c2e5e1b5 (patch) | |
tree | adf2453955649221a9a178d7d19d5b1e71f3fe67 /kernel/ptrace.c | |
parent | b172e38e435a158cc84169d5b9127a8dd8d21e76 (diff) |
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@intel.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r-- | kernel/ptrace.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 9de3ecfd20f9..a70d2a5d8c7b 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -744,20 +744,17 @@ int ptrace_request(struct task_struct *child, long request, | |||
744 | break; | 744 | break; |
745 | 745 | ||
746 | si = child->last_siginfo; | 746 | si = child->last_siginfo; |
747 | if (unlikely(!si || si->si_code >> 8 != PTRACE_EVENT_STOP)) | 747 | if (likely(si && (si->si_code >> 8) == PTRACE_EVENT_STOP)) { |
748 | break; | 748 | child->jobctl |= JOBCTL_LISTENING; |
749 | 749 | /* | |
750 | child->jobctl |= JOBCTL_LISTENING; | 750 | * If NOTIFY is set, it means event happened between |
751 | 751 | * start of this trap and now. Trigger re-trap. | |
752 | /* | 752 | */ |
753 | * If NOTIFY is set, it means event happened between start | 753 | if (child->jobctl & JOBCTL_TRAP_NOTIFY) |
754 | * of this trap and now. Trigger re-trap immediately. | 754 | signal_wake_up(child, true); |
755 | */ | 755 | ret = 0; |
756 | if (child->jobctl & JOBCTL_TRAP_NOTIFY) | 756 | } |
757 | signal_wake_up(child, true); | ||
758 | |||
759 | unlock_task_sighand(child, &flags); | 757 | unlock_task_sighand(child, &flags); |
760 | ret = 0; | ||
761 | break; | 758 | break; |
762 | 759 | ||
763 | case PTRACE_DETACH: /* detach a process that was attached. */ | 760 | case PTRACE_DETACH: /* detach a process that was attached. */ |