diff options
| author | 2011-04-03 14:56:27 +0000 | |
|---|---|---|
| committer | 2011-04-03 14:56:27 +0000 | |
| commit | c0ce47d96f277436fbde5279039dad42b016a9b2 (patch) | |
| tree | ba57ac46912617f1c7dd53acb3befb855db19709 /sys/kern/kern_exit.c | |
| parent | No need to include uvm/uvm_extern.h and fix a typo. (diff) | |
| download | wireguard-openbsd-c0ce47d96f277436fbde5279039dad42b016a9b2.tar.xz wireguard-openbsd-c0ce47d96f277436fbde5279039dad42b016a9b2.zip | |
Move PPWAIT flag from struct proc to process, so that rthreads in
a vforked child behave correctly. Have the parent in a vfork()
wait on a (different) flag in *its* process instead of the child
to prevent a possible use-after-free. When ktracing the child
return from a fork, call it rfork if an rthread was created.
ok blambert@
Diffstat (limited to 'sys/kern/kern_exit.c')
| -rw-r--r-- | sys/kern/kern_exit.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 792f8391340..40c73d9a7ab 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.97 2010/08/02 19:54:07 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.98 2011/04/03 14:56:28 guenther Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -162,11 +162,13 @@ exit1(struct proc *p, int rv, int flags) while (!TAILQ_EMPTY(&pr->ps_threads)) tsleep(&pr->ps_threads, PUSER, "thrdeath", 0); /* - * If parent is waiting for us to exit or exec, P_PPWAIT + * If parent is waiting for us to exit or exec, PS_PPWAIT * is set; we wake up the parent early to avoid deadlock. */ - if (p->p_flag & P_PPWAIT) { - atomic_clearbits_int(&p->p_flag, P_PPWAIT); + if (pr->ps_flags & PS_PPWAIT) { + atomic_clearbits_int(&pr->ps_flags, PS_PPWAIT); + atomic_clearbits_int(&pr->ps_pptr->ps_flags, + PS_ISPWAIT); wakeup(pr->ps_pptr); } } |
