Skip to content

Commit 0ae8ce1

Browse files
committed
ptrace: Participate in group stop from ptrace_stop() iff the task is trapping for group stop
Currently, ptrace_stop() unconditionally participates in group stop bookkeeping. This is unnecessary and inaccurate. Make it only participate if the task is trapping for group stop - ie. if @why is CLD_STOPPED. As ptrace_stop() currently is not used when trapping for group stop, this equals to disabling group stop participation from ptrace_stop(). A visible behavior change is increased likelihood of delayed group stop completion if the thread group contains one or more ptraced tasks. This is to preapre for further cleanup of the interaction between group stop and ptrace. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: Roland McGrath <roland@redhat.com>
1 parent 39efa3e commit 0ae8ce1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kernel/signal.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,10 +1694,13 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
16941694
}
16951695

16961696
/*
1697-
* If there is a group stop in progress,
1698-
* we must participate in the bookkeeping.
1697+
* If @why is CLD_STOPPED, we're trapping to participate in a group
1698+
* stop. Do the bookkeeping. Note that if SIGCONT was delievered
1699+
* while siglock was released for the arch hook, PENDING could be
1700+
* clear now. We act as if SIGCONT is received after TASK_TRACED
1701+
* is entered - ignore it.
16991702
*/
1700-
if (current->group_stop & GROUP_STOP_PENDING)
1703+
if (why == CLD_STOPPED && (current->group_stop & GROUP_STOP_PENDING))
17011704
task_participate_group_stop(current);
17021705

17031706
current->last_siginfo = info;

0 commit comments

Comments
 (0)