]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC 283281,283282,283562,283647,283836,284000,286158:
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 9 Sep 2015 23:39:30 +0000 (23:39 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 9 Sep 2015 23:39:30 +0000 (23:39 +0000)
commit767ab74985ffe737ae60d81984b62864962691dc
tree76e5aaf146ac3d3a13836825fb8ac24a7388921a
parentdaf13f28358e22847377e76ba59600146db7dca6
MFC 283281,283282,283562,283647,283836,284000,286158:
Various fixes to orphan handling which also fix issues with following
forks.

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.

Add test cases for PT_TRACE_ME and PT_ATTACH which are fixed by
this change.

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().

Add two tests for for this case: one where the debugger is the direct
child (thus the parent has a non-empty children list) and one where
the debugger is not a direct child (so the only "child" of the parent
is the orphan).

283647:
Tweak the description of when waitpid() doesn't return any status for a
non-blocking wait to avoid the word "empty".

283836:
Consistently only use one end of the pipe in the parent and debugger
processes and do not rely on EOF due to a close() in the debugger.

284000:
Add a CHILD_REQUIRE macro similar to ATF_REQUIRE for use in child processes
of the main test process.

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.

Add tests for tracing forks via PT_FOLLOW_FORK.

git-svn-id: svn://svn.freebsd.org/base/stable/10@287604 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/fs/procfs/procfs_ctl.c
sys/kern/kern_exit.c
sys/kern/sys_process.c
tests/sys/kern/Makefile
tests/sys/kern/ptrace_test.c [new file with mode: 0644]