Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ee11844 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

ptrace_untrace: fix the SIGNAL_STOP_STOPPED check



This bug is ancient too. ptrace_untrace() must not resume the task
if the group stop in progress, we should set TASK_STOPPED instead.

Unfortunately, we still have problems here:

	- if the process/thread was traced, SIGNAL_STOP_STOPPED
	  does not necessary means this thread group is stopped.

	- ptrace breaks the bookkeeping of ->group_stop_count.

Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 95a3540d
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -60,12 +60,16 @@ static void ptrace_untrace(struct task_struct *child)
{
{
	spin_lock(&child->sighand->siglock);
	spin_lock(&child->sighand->siglock);
	if (task_is_traced(child)) {
	if (task_is_traced(child)) {
		if (child->signal->flags & SIGNAL_STOP_STOPPED) {
		/*
		 * If the group stop is completed or in progress,
		 * this thread was already counted as stopped.
		 */
		if (child->signal->flags & SIGNAL_STOP_STOPPED ||
		    child->signal->group_stop_count)
			__set_task_state(child, TASK_STOPPED);
			__set_task_state(child, TASK_STOPPED);
		} else {
		else
			signal_wake_up(child, 1);
			signal_wake_up(child, 1);
	}
	}
	}
	spin_unlock(&child->sighand->siglock);
	spin_unlock(&child->sighand->siglock);
}
}