View | Details | Raw Unified | Return to bug 201276 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/kern/kern_exit.c (-2 / +10 lines)
Lines 340-346 exit1(struct thread *td, int rval, int signo) Link Here
340
	 */
340
	 */
341
	PROC_LOCK(p);
341
	PROC_LOCK(p);
342
	stopprofclock(p);
342
	stopprofclock(p);
343
	p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
343
	p->p_flag &= ~(P_PPWAIT | P_PPTRACE);
344
	p->p_ptevents = 0;
344
	p->p_ptevents = 0;
345
345
346
	/*
346
	/*
Lines 856-861 proc_reap(struct thread *td, struct proc *p, int *status, int options) Link Here
856
	 * to the old parent.
856
	 * to the old parent.
857
	 */
857
	 */
858
	if (p->p_oppid != 0 && p->p_oppid != p->p_pptr->p_pid) {
858
	if (p->p_oppid != 0 && p->p_oppid != p->p_pptr->p_pid) {
859
		p->p_flag &= ~P_TRACED;
859
		PROC_UNLOCK(p);
860
		PROC_UNLOCK(p);
860
		t = proc_realparent(p);
861
		t = proc_realparent(p);
861
		PROC_LOCK(t);
862
		PROC_LOCK(t);
Lines 971-977 proc_to_reap(struct thread *td, struct proc *p, idtype_t idtype, id_t id, Link Here
971
972
972
	switch (idtype) {
973
	switch (idtype) {
973
	case P_ALL:
974
	case P_ALL:
974
		if (p->p_procdesc != NULL) {
975
		/*
976
		 * Usually, processes created with pdfork(2) should be
977
		 * invisible to wait(2) when using P_ALL. However, ptrace(2) in
978
		 * PTRACE_FORK mode does not know whether a process was created
979
		 * by pdfork(2) or fork(2) and expects the tracing process
980
		 * to deal with the new process in its event loop.
981
		 */
982
		if (p->p_procdesc != NULL && !(p->p_flag & P_TRACED)) {
975
			PROC_UNLOCK(p);
983
			PROC_UNLOCK(p);
976
			return (0);
984
			return (0);
977
		}
985
		}
(-)b/sys/kern/sys_procdesc.c (-5 / +7 lines)
Lines 410-421 procdesc_close(struct file *fp, struct thread *td) Link Here
410
			procdesc_free(pd);
410
			procdesc_free(pd);
411
411
412
			/*
412
			/*
413
			 * Next, reparent it to init(8) so that there's someone
413
			 * In case there is no tracing process, reparent to
414
			 * to pick up the pieces; finally, terminate with
414
			 * p_reaper so that there's someone to pick up the
415
			 * prejudice.
415
			 * pieces; finally, terminate with prejudice.
416
			 */
416
			 */
417
			p->p_sigparent = SIGCHLD;
417
			if (!(p->p_flag & P_TRACED)) {
418
			proc_reparent(p, initproc);
418
				p->p_sigparent = SIGCHLD;
419
				proc_reparent(p, p->p_reaper);
420
			}
419
			if ((pd->pd_flags & PDF_DAEMON) == 0)
421
			if ((pd->pd_flags & PDF_DAEMON) == 0)
420
				kern_psignal(p, SIGKILL);
422
				kern_psignal(p, SIGKILL);
421
			PROC_UNLOCK(p);
423
			PROC_UNLOCK(p);

Return to bug 201276