提交 f9d81f61 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

ptrace: PTRACE_LISTEN forgets to unlock ->siglock

If PTRACE_LISTEN fails after lock_task_sighand() it doesn't drop ->siglock.
Reported-by: NMatt Fleming <matt.fleming@intel.com>
Signed-off-by: NOleg Nesterov <oleg@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b172e38e
...@@ -744,20 +744,17 @@ int ptrace_request(struct task_struct *child, long request, ...@@ -744,20 +744,17 @@ int ptrace_request(struct task_struct *child, long request,
break; break;
si = child->last_siginfo; si = child->last_siginfo;
if (unlikely(!si || si->si_code >> 8 != PTRACE_EVENT_STOP)) if (likely(si && (si->si_code >> 8) == PTRACE_EVENT_STOP)) {
break; child->jobctl |= JOBCTL_LISTENING;
/*
child->jobctl |= JOBCTL_LISTENING; * If NOTIFY is set, it means event happened between
* start of this trap and now. Trigger re-trap.
/* */
* If NOTIFY is set, it means event happened between start if (child->jobctl & JOBCTL_TRAP_NOTIFY)
* of this trap and now. Trigger re-trap immediately. signal_wake_up(child, true);
*/ ret = 0;
if (child->jobctl & JOBCTL_TRAP_NOTIFY) }
signal_wake_up(child, true);
unlock_task_sighand(child, &flags); unlock_task_sighand(child, &flags);
ret = 0;
break; break;
case PTRACE_DETACH: /* detach a process that was attached. */ case PTRACE_DETACH: /* detach a process that was attached. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册