summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-02-07 15:34:22 +0000
committerkib <kib@FreeBSD.org>2013-02-07 15:34:22 +0000
commitde5bb93ec15ad24564702e50ee96168afb61b9bb (patch)
tree8b7633bc4cc514b9ef61e2f4c384c22cb0708ed9 /sys/kern/kern_exit.c
parent75ad250e9798bf02f5b9ad805d88a8852c3e9545 (diff)
downloadFreeBSD-src-de5bb93ec15ad24564702e50ee96168afb61b9bb.zip
FreeBSD-src-de5bb93ec15ad24564702e50ee96168afb61b9bb.tar.gz
When vforked child is traced, the debugging events are not generated
until child performs exec(). The behaviour is reasonable when a debugger is the real parent, because the parent is stopped until exec(), and sending a debugging event to the debugger would deadlock both parent and child. On the other hand, when debugger is not the parent of the vforked child, not sending debugging signals makes it impossible to debug across vfork. Fix the issue by declining generating debug signals only when vfork() was done and child called ptrace(PT_TRACEME). Set a new process flag P_PPTRACE from the attach code for PT_TRACEME, if P_PPWAIT flag is set, which indicates that the process was created with vfork() and still did not execed. Check P_PPTRACE from issignal(), instead of refusing the trace outright for the P_PPWAIT case. The scope of P_PPTRACE is exactly contained in the scope of P_PPWAIT. Found and tested by: zont Reviewed by: pluknet MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 3a9a3a4..82f0344 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -266,7 +266,7 @@ exit1(struct thread *td, int rv)
PROC_LOCK(p);
rv = p->p_xstat; /* Event handler could change exit status */
stopprofclock(p);
- p->p_flag &= ~(P_TRACED | P_PPWAIT);
+ p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
/*
* Stop the real interval timer. If the handler is currently
OpenPOWER on IntegriCloud