Page MenuHomeFreeBSD

D3973.diff
No OneTemporary

D3973.diff

Index: head/sys/kern/kern_fork.c
===================================================================
--- head/sys/kern/kern_fork.c
+++ head/sys/kern/kern_fork.c
@@ -586,7 +586,7 @@
* been preserved.
*/
p2->p_flag |= p1->p_flag & P_SUGID;
- td2->td_pflags |= td->td_pflags & TDP_ALTSTACK;
+ td2->td_pflags |= (td->td_pflags & TDP_ALTSTACK) | TDP_FORKING;
SESS_LOCK(p1->p_session);
if (p1->p_session->s_ttyvp != NULL && p1->p_flag & P_CONTROLT)
p2->p_flag |= P_CONTROLT;
@@ -1023,6 +1023,7 @@
if (p->p_sysent->sv_schedtail != NULL)
(p->p_sysent->sv_schedtail)(td);
+ td->td_pflags &= ~TDP_FORKING;
}
/*
Index: head/sys/kern/subr_syscall.c
===================================================================
--- head/sys/kern/subr_syscall.c
+++ head/sys/kern/subr_syscall.c
@@ -176,6 +176,9 @@
struct proc *p, *p2;
int traced;
+ KASSERT((td->td_pflags & TDP_FORKING) == 0,
+ ("fork() did not clear TDP_FORKING upon completion"));
+
p = td->td_proc;
/*
Index: head/sys/sys/proc.h
===================================================================
--- head/sys/sys/proc.h
+++ head/sys/sys/proc.h
@@ -446,7 +446,7 @@
#define TDP_RESETSPUR 0x04000000 /* Reset spurious page fault history. */
#define TDP_NERRNO 0x08000000 /* Last errno is already in td_errno */
#define TDP_UIOHELD 0x10000000 /* Current uio has pages held in td_ma */
-#define TDP_UNUSED29 0x20000000 /* --available-- */
+#define TDP_FORKING 0x20000000 /* Thread is being created through fork() */
#define TDP_EXECVMSPC 0x40000000 /* Execve destroyed old vmspace */
/*

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 9, 7:20 PM (6 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31168731
Default Alt Text
D3973.diff (1 KB)

Event Timeline