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)
Feb 12 2024, 3:46 PM
Unknown Object (File)
Jan 3 2024, 7:48 AM
Unknown Object (File)
Dec 31 2023, 4:13 AM
Unknown Object (File)
Dec 23 2023, 9:09 AM
Unknown Object (File)
Dec 12 2023, 4:25 PM
Unknown Object (File)
Nov 10 2023, 9:28 AM
Unknown Object (File)
Oct 12 2023, 4:41 AM
Unknown Object (File)
Oct 9 2023, 8:24 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.