浏览代码

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: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds 19 年之前
父节点
当前提交
28d838cc4d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      kernel/ptrace.c

+ 1 - 1
kernel/ptrace.c

@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *task)
 	retval = -EPERM;
 	if (task->pid <= 1)
 		goto bad;
-	if (task == current)
+	if (task->tgid == current->tgid)
 		goto bad;
 	/* the same process cannot be attached many times */
 	if (task->ptrace & PT_PTRACED)