summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-09 05:13:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-09 05:13:56 +0000
commit5336a63e9b58cc2703d970750bb3df3d1585ef0d (patch)
tree7fd651609353deb1131299791b6de500f2d18ecf /sys/kern
parent69817b230bc02fcffaba1de32581a16c7a2eec81 (diff)
systrace activation happens in the middle of a rather sensitive piece of
fork(), i worry about it a lot but cannot prove yet that sleeping there is bad. Anyways, this change makes us never sleep in that area -- the memory needed is allocated ealier like the ptrace state. tested by many developers.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index e87bf06c0ce..8c00895a41f 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.99 2008/11/03 03:03:35 deraadt Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.100 2008/11/09 05:13:55 deraadt Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -182,6 +182,9 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
extern void endtsleep(void *);
extern void realitexpire(void *);
struct ptrace_state *newptstat;
+#if NSYSTRACE > 0
+ void *newstrp = NULL;
+#endif
/*
* Although process entries are dynamically created, we still keep
@@ -385,6 +388,10 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
}
newptstat = malloc(sizeof(struct ptrace_state), M_SUBPROC, M_WAITOK);
+#if NSYSTRACE > 0
+ if (ISSET(p1->p_flag, P_SYSTRACE))
+ newstrp = systrace_getproc();
+#endif
/* Find an unused pid satisfying 1 <= lastpid <= PID_MAX */
do {
@@ -415,8 +422,8 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
}
#if NSYSTRACE > 0
- if (ISSET(p1->p_flag, P_SYSTRACE))
- systrace_fork(p1, p2);
+ if (newstrp)
+ systrace_fork(p1, p2, newstrp);
#endif
/*