summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-08-07 05:47:53 +0000
committerkib <kib@FreeBSD.org>2014-08-07 05:47:53 +0000
commit0b059d23c7081e1cea5512459c573223dc017be9 (patch)
tree033a19954132b23984c24a614f928220b364cc2b /bin
parentffe6b11ba6dedd5eff6feb31b9e53c526bf6c5dd (diff)
downloadFreeBSD-src-0b059d23c7081e1cea5512459c573223dc017be9.zip
FreeBSD-src-0b059d23c7081e1cea5512459c573223dc017be9.tar.gz
Correct the problems with the ptrace(2) making the debuggee an orphan.
One problem is inferior(9) looping due to the process tree becoming a graph instead of tree if the parent is traced by child. Another issue is due to the use of p_oppid to restore the original parent/child relationship, because real parent could already exited and its pid reused (noted by mjg). Add the function proc_realparent(9), which calculates the parent for given process. It uses the flag P_TREE_FIRST_ORPHAN to detect the head element of the p_orphan list and than stepping back to its container to find the parent process. If the parent has already exited, the init(8) is returned. Move the P_ORPHAN and the new helper flag from the p_flag* to new p_treeflag field of struct proc, which is protected by proctree lock instead of proc lock, since the orphans relationship is managed under the proctree_lock already. The remaining uses of p_oppid in ptrace(PT_DETACH) and process reapping are replaced by proc_realparent(9). Phabric: D417 Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/ps.13
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/ps/ps.1 b/bin/ps/ps.1
index 3d7edf7..d8e56fb 100644
--- a/bin/ps/ps.1
+++ b/bin/ps/ps.1
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd June 6, 2014
+.Dd August 7, 2014
.Dt PS 1
.Os
.Sh NAME
@@ -332,7 +332,6 @@ the include file
.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary"
.It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs"
.It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail"
-.It Dv "P_ORPHAN" Ta No "0x2000000" Ta "Orphaned by original parent, reparented to debugger"
.It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()"
.It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited"
.It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory"
OpenPOWER on IntegriCloud