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
F103017524: D41122.diff
Tue, Nov 19, 9:19 PM
Unknown Object (File)
Sep 30 2024, 12:25 AM
Unknown Object (File)
Sep 22 2024, 10:35 PM
Unknown Object (File)
Sep 22 2024, 10:34 PM
Unknown Object (File)
Sep 22 2024, 10:34 PM
Unknown Object (File)
Sep 22 2024, 10:23 PM
Unknown Object (File)
Sep 15 2024, 12:52 AM
Unknown Object (File)
Sep 4 2024, 8:21 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 Passed
Unit
No Test Coverage
Build Status
Buildable 52760
Build 49651: arc lint + arc unit