linux: wait for process before detach, and send SIGCONT #1

Merged
jan merged 1 commits from XeroOl/mem_edit:master into master 2 years ago
XeroOl commented 2 years ago

Every once in a while, the ptrace call would fail because the process
has not yet stopped from SIGSTOP. From this stackoverflow answer, it
seems that you can use waitpid to wait until the process is actually
stopped. In python, this is exposed as os.waitpid.

https://stackoverflow.com/questions/20510300/ptrace-detach-fails-after-ptrace-cont-with-errno-esrch#20525326

Additionally, the process was left frozen. Sending a SIGCONT tells
the process to continue, undoing the effect of SIGSTOP. This means
that the process isn't frozen when detached.

Every once in a while, the ptrace call would fail because the process has not yet stopped from SIGSTOP. From this stackoverflow answer, it seems that you can use waitpid to wait until the process is actually stopped. In python, this is exposed as os.waitpid. https://stackoverflow.com/questions/20510300/ptrace-detach-fails-after-ptrace-cont-with-errno-esrch#20525326 Additionally, the process was left frozen. Sending a SIGCONT tells the process to continue, undoing the effect of SIGSTOP. This means that the process isn't frozen when detached.
XeroOl added 1 commit 2 years ago
46e9456fd4 linux: wait for process before detach, and send SIGCONT
I had issues with the ptrace call failing because the process had not yet stopped
from SIGSTOP.
From this stackoverflow answer, it seems that you can use waitpid to
wait until the process is actually stopped. In python, this is exposed
as os.waitpid.

https://stackoverflow.com/questions/20510300/ptrace-detach-fails-after-ptrace-cont-with-errno-esrch#20525326

Additionally, the process was left frozen. I send a SIGCONT to continue
the process after the detach, so that it isn't left stopped.
jan merged commit d49555ad15 into master 2 years ago
jan commented 2 years ago
Owner

Thank you for the fix and explanation!

Thank you for the fix and explanation!
The pull request has been merged as d49555ad15.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b XeroOl-master master
git pull master

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff XeroOl-master
git push origin master
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jan/mem_edit#1
Loading…
There is no content yet.