FreeBSD Bugzilla – Attachment 198099 Details for
Bug 201276
truss(1): truss -f doesn't followed pdfork()ed descendents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v2 of patch
special-case-traced-procs-in-wait6-v2.patch (text/plain), 2.02 KB, created by
Jan Kokemüller
on 2018-10-13 12:48:54 UTC
(
hide
)
Description:
v2 of patch
Filename:
MIME Type:
Creator:
Jan Kokemüller
Created:
2018-10-13 12:48:54 UTC
Size:
2.02 KB
patch
obsolete
>diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c >index 55f08a004eb4..9192f9bb8367 100644 >--- a/sys/kern/kern_exit.c >+++ b/sys/kern/kern_exit.c >@@ -340,7 +340,7 @@ exit1(struct thread *td, int rval, int signo) > */ > PROC_LOCK(p); > stopprofclock(p); >- p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); >+ p->p_flag &= ~(P_PPWAIT | P_PPTRACE); > p->p_ptevents = 0; > > /* >@@ -856,6 +856,7 @@ proc_reap(struct thread *td, struct proc *p, int *status, int options) > * to the old parent. > */ > if (p->p_oppid != 0 && p->p_oppid != p->p_pptr->p_pid) { >+ p->p_flag &= ~P_TRACED; > PROC_UNLOCK(p); > t = proc_realparent(p); > PROC_LOCK(t); >@@ -971,7 +972,14 @@ proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id, > > switch (idtype) { > case P_ALL: >- if (p->p_procdesc != NULL) { >+ /* >+ * Usually, processes created with pdfork(2) should be >+ * invisible to wait(2) when using P_ALL. However, ptrace(2) in >+ * PTRACE_FORK mode does not know whether a process was created >+ * by pdfork(2) or fork(2) and expects the tracing process >+ * to deal with the new process in its event loop. >+ */ >+ if (p->p_procdesc != NULL && !(p->p_flag & P_TRACED)) { > PROC_UNLOCK(p); > return (0); > } >diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c >index 859a2a4a108e..1e9fb4e42c6e 100644 >--- a/sys/kern/sys_procdesc.c >+++ b/sys/kern/sys_procdesc.c >@@ -410,12 +410,14 @@ procdesc_close(struct file *fp, struct thread *td) > procdesc_free(pd); > > /* >- * Next, reparent it to init(8) so that there's someone >- * to pick up the pieces; finally, terminate with >- * prejudice. >+ * In case there is no tracing process, reparent to >+ * p_reaper so that there's someone to pick up the >+ * pieces; finally, terminate with prejudice. > */ >- p->p_sigparent = SIGCHLD; >- proc_reparent(p, initproc); >+ if (!(p->p_flag & P_TRACED)) { >+ p->p_sigparent = SIGCHLD; >+ proc_reparent(p, p->p_reaper); >+ } > if ((pd->pd_flags & PDF_DAEMON) == 0) > kern_psignal(p, SIGKILL); > PROC_UNLOCK(p);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201276
:
187941
| 198099