diff options
author | kib <kib@FreeBSD.org> | 2016-02-04 10:49:34 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-02-04 10:49:34 +0000 |
commit | ce2fb04a46c2cc3b31ab973bbde3bc7d5c609e5e (patch) | |
tree | fa2e6a0795eaa8db77aba346ba784ea5b5628986 /sys/kern | |
parent | 46763fd4ca8a37f836c9bf2333f9d687509278f3 (diff) | |
download | FreeBSD-src-ce2fb04a46c2cc3b31ab973bbde3bc7d5c609e5e.zip FreeBSD-src-ce2fb04a46c2cc3b31ab973bbde3bc7d5c609e5e.tar.gz |
Guard against runnable td2 exiting and than being reused for unrelated
process when the parent sleeps waiting for the debugger attach on
fork.
Diagnosed and reviewed by: mjg
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_fork.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index baee954..5bb14e8 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -777,7 +777,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * /* * Wait until debugger is attached to child. */ - while ((td2->td_dbgflags & TDB_STOPATFORK) != 0) + while (td2->td_proc == p2 && (td2->td_dbgflags & TDB_STOPATFORK) != 0) cv_wait(&p2->p_dbgwait, &p2->p_mtx); _PRELE(p2); racct_proc_fork_done(p2); |