HomeFreeBSD

MFC 283281,283282,283562,286158:

Description

MFC 283281,283282,283562,286158:
Various fixes to orphan handling which also fix issues with following
forks. Unlike the changes in HEAD, this merge does not include the
changes to the ATF ptrace test since ATF is not present in 9.

283281:
Always set p_oppid when attaching to an existing process via procfs
tracing. This matches the behavior of ptrace(PT_ATTACH). Also,
the procfs detach request assumes p_oppid is always set.

283282:
Only reparent a traced process to its old parent if the tracing process is
not the old parent. Otherwise, proc_reap() will leave the zombie in place
resulting in the process' status being returned twice to its parent.

283562:
Do not allow a process to reap an orphan (a child currently being
traced by another process such as a debugger). The parent process does
need to check for matching orphan pids to avoid returning ECHILD if an
orphan has exited, but it should not return the exited status for the
child until after the debugger has detached from the orphan process
either explicitly or implicitly via wait().

286158:
Clear P_TRACED before reparenting a detached process back to its
original parent. Otherwise the debugee will be set as an orphan of
the debugger.

Details

Provenance
jhbAuthored on
Parents
rS287604: MFC 283281,283282,283562,283647,283836,284000,286158:
Branches
Unknown
Tags
Unknown