HomeFreeBSD

truss(1): detach more carefully

Description

truss(1): detach more carefully

When detaching, truss(1) sends SIGSTOP to the traced process to ensure
that it is detaching in the steady state. But it is possible, for
multithreaded process, that wait() call returns event other than our
SIGSTOP notification. As result, SIGSTOP might sit in some thread'
sigqueue, which makes SIGCONT a nop. Then, the process is stopped when
the queued SIGSTOP is acted upon.

To handle this, loop until we drain everything before SIGSTOP,
and see that the process is stopped.

Note that the earlier fix makes it safe to have some more debugging
events longering after SIGSTOP is acted upon. They will be ignored
after PT_DETACH.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33861

Details

Provenance
kibAuthored on Jan 12 2022, 8:21 AM
Reviewer
markj
Differential Revision
D33861: truss(1): detach more carefully
Parents
rGba33c288488d: truss: remove write-only variable
Branches
Unknown
Tags
Unknown