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

ptrace_check_attach: remove unneeded ->signal != NULL check

It is not possible to see the PT_PTRACED task without ->signal/sighand under
tasklist_lock, release_task() does ptrace_unlink() first.  If the task was
already released before, ptrace_attach() can't succeed and set PT_PTRACED.
Remove this check.
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NRoland McGrath <roland@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 34a1738f
...@@ -99,9 +99,12 @@ int ptrace_check_attach(struct task_struct *child, int kill) ...@@ -99,9 +99,12 @@ int ptrace_check_attach(struct task_struct *child, int kill)
* be changed by us so it's not changing right after this. * be changed by us so it's not changing right after this.
*/ */
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
if ((child->ptrace & PT_PTRACED) && child->parent == current && if ((child->ptrace & PT_PTRACED) && child->parent == current) {
child->signal != NULL) {
ret = 0; ret = 0;
/*
* child->sighand can't be NULL, release_task()
* does ptrace_unlink() before __exit_signal().
*/
spin_lock_irq(&child->sighand->siglock); spin_lock_irq(&child->sighand->siglock);
if (task_is_stopped(child)) if (task_is_stopped(child))
child->state = TASK_TRACED; child->state = TASK_TRACED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册