提交 0b1007c3 编写于 作者: T Tejun Heo 提交者: Oleg Nesterov

ptrace: remove silly wait_trap variable from ptrace_attach()

Remove local variable wait_trap which determines whether to wait for
!TRAPPING or not and simply wait for it if attach was successful.

-v2: Oleg pointed out wait should happen iff attach was successful.
Signed-off-by: NTejun Heo <tj@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: NOleg Nesterov <oleg@redhat.com>
上级 23c79d31
...@@ -184,7 +184,6 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) ...@@ -184,7 +184,6 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode)
static int ptrace_attach(struct task_struct *task) static int ptrace_attach(struct task_struct *task)
{ {
bool wait_trap = false;
int retval; int retval;
audit_ptrace(task); audit_ptrace(task);
...@@ -246,7 +245,6 @@ static int ptrace_attach(struct task_struct *task) ...@@ -246,7 +245,6 @@ static int ptrace_attach(struct task_struct *task)
if (task_is_stopped(task)) { if (task_is_stopped(task)) {
task->group_stop |= GROUP_STOP_PENDING | GROUP_STOP_TRAPPING; task->group_stop |= GROUP_STOP_PENDING | GROUP_STOP_TRAPPING;
signal_wake_up(task, 1); signal_wake_up(task, 1);
wait_trap = true;
} }
spin_unlock(&task->sighand->siglock); spin_unlock(&task->sighand->siglock);
...@@ -257,7 +255,7 @@ static int ptrace_attach(struct task_struct *task) ...@@ -257,7 +255,7 @@ static int ptrace_attach(struct task_struct *task)
unlock_creds: unlock_creds:
mutex_unlock(&task->signal->cred_guard_mutex); mutex_unlock(&task->signal->cred_guard_mutex);
out: out:
if (wait_trap) if (!retval)
wait_event(current->signal->wait_chldexit, wait_event(current->signal->wait_chldexit,
!(task->group_stop & GROUP_STOP_TRAPPING)); !(task->group_stop & GROUP_STOP_TRAPPING));
return retval; return retval;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册