Page MenuHomeFreeBSD

proc_detach: use ptrace(PT_KILL) to kill the tracee
ClosedPublic

Authored by vangyzen on Jul 20 2023, 8:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 4, 1:16 PM
Unknown Object (File)
Thu, May 2, 10:43 AM
Unknown Object (File)
Thu, May 2, 10:38 AM
Unknown Object (File)
Thu, May 2, 10:37 AM
Unknown Object (File)
Thu, May 2, 9:08 AM
Unknown Object (File)
Apr 14 2024, 5:31 PM
Unknown Object (File)
Mar 22 2024, 7:16 PM
Unknown Object (File)
Mar 13 2024, 3:07 AM

Details

Summary

When MFC'ing commit dad11f990e2 to stable/12, the child would dump core
when dtrace exited. It was getting SIGTRAP, even though proc_detach
sent a SIGKILL. I could not find the reason for this difference in
behavior from main (and stable/13). The present change, however, works
as expected, probably due the proc_wkilled special case in kern_ptrace.
It also seems like a more obvious approach.

While I'm here, fix two other issues in the previous code:

It would SIGKILL a tracee even in read-only mode.

It would SIGSTOP/SIGCONT the tracee if ptrace succeeded but errno happened
to be EBUSY for some other reason.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

Test Plan

All libproc tests passed. There was no change in the dtrace test results.
There were no unexpected core files.

All of this testing was done on main, then repeated on stable/13 and stable/12
with a pending MFC of commit dad11f990e2.

Diff Detail

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