Page MenuHomeFreeBSD

Make ptrace(2) operating on process descriptors
Needs ReviewPublic

Authored by kib on Sat, Aug 1, 12:30 PM.
Tags
None
Referenced Files
F164678488: D58586.diff
Mon, Aug 3, 3:25 AM
F164673277: D58586.diff
Mon, Aug 3, 2:45 AM
Unknown Object (File)
Sat, Aug 1, 11:46 PM
Unknown Object (File)
Sat, Aug 1, 10:56 PM

Details

Reviewers
markj
jhb
Summary
capsicum: add CAP_PTRACE

The capability will allow the ptrace(2) on the procdesc.


pdfork(2): add PD_PTRACE_CAP flag

If the flag is not specified, the process descriptor returned by either
pdfork(2) or pdopenpid(2) has the CAP_PTRACE capability disabled.


ptrace(2): add PT_PROCDESC request modifier


ptrace.2: document PT_PROCDESC

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Sat, Aug 1, 12:30 PM

This patch adds a capability for ptrace, and allows to do ptrace(req, procdesc, addr, data) instead of ptrace(req, pid, addr, data).

By default, the capability is not enabled, the caller of pdfork(2) or pdopenpid(2) must explicitly prepare process descriptor for debugging.
This way, the existing code that creates process descriptors and passes it somewhere, does not suddenly allow the recipient to debug the process, but it can allow if wanted.