提交 28d838cc 编写于 作者: L Linus Torvalds

Fix ptrace self-attach rule

Before we did CLONE_THREAD, the way to check whether we were attaching
to ourselves was to just check "current == task", but with CLONE_THREAD
we should check that the thread group ID matches instead.
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 ac111bfa
...@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *task) ...@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *task)
retval = -EPERM; retval = -EPERM;
if (task->pid <= 1) if (task->pid <= 1)
goto bad; goto bad;
if (task == current) if (task->tgid == current->tgid)
goto bad; goto bad;
/* the same process cannot be attached many times */ /* the same process cannot be attached many times */
if (task->ptrace & PT_PTRACED) if (task->ptrace & PT_PTRACED)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册