This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [Process/FreeBSD] Do not send SIGSTOP to stopped process
ClosedPublic

Authored by mgorny on Jun 1 2022, 4:45 AM.

Details

Summary

Do not send SIGSTOP when requested to halt a process that's already
stopped. This results in the signal being queued for delivery once
the process is resumed, and unexpectedly stopping it again.

This is necessary for non-stop protocol patches to land.

Sponsored by: The FreeBSD Foundation

Diff Detail

Event Timeline

mgorny created this revision.Jun 1 2022, 4:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 4:45 AM
Herald added a subscriber: arichardson. · View Herald Transcript
krytarowski accepted this revision.Jun 1 2022, 4:48 AM
This revision is now accepted and ready to land.Jun 1 2022, 4:48 AM
mgorny edited the summary of this revision. (Show Details)Jun 1 2022, 4:59 AM
emaste accepted this revision.Jun 1 2022, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2022, 6:19 AM

This still leaves the possibility of a race where the process stops on its own while you're in the process of sending the signal, right?

I believe that on linux we handling this by checking the stopped events: If the application stopped due to a signal from us (siginfo->si_pid == getpid()) *and* we're not currently trying to stop a process, then we transparently resume it. Maybe you need to do the same here?

(Actually, I don't think we do it for the main Halt operation (though maybe we should) -- only for the SIGSTOPs send to individual threads when we're performing an all-stop.)