Page MenuHomeFreeBSD

truss(1): detach more carefully
ClosedPublic

Authored by kib on Jan 12 2022, 8:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 1:52 PM
Unknown Object (File)
Sat, Nov 23, 11:51 PM
Unknown Object (File)
Fri, Nov 22, 5:56 AM
Unknown Object (File)
Thu, Nov 21, 8:19 AM
Unknown Object (File)
Nov 5 2024, 1:01 PM
Unknown Object (File)
Nov 2 2024, 8:25 AM
Unknown Object (File)
Oct 31 2024, 1:20 PM
Unknown Object (File)
Oct 31 2024, 8:27 AM
Subscribers

Details

Summary
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.

Also

truss: remove write-only variable

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jan 12 2022, 8:28 AM

Remove unneeded filtering of sig == 0/non-stopped state event.

This revision is now accepted and ready to land.Jan 12 2022, 1:55 PM
This revision was automatically updated to reflect the committed changes.