summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2004-10-06 14:23:00 +0000
committermtm <mtm@FreeBSD.org>2004-10-06 14:23:00 +0000
commit0a21f474dc2916335177c20f10de96a7a093926e (patch)
tree3804089a0d0cecc531066dc2a0a074eddea8153b /sys/kern/kern_thr.c
parent66f574f53756cb0fd20f1dd2790d90850ef49f3c (diff)
downloadFreeBSD-src-0a21f474dc2916335177c20f10de96a7a093926e.zip
FreeBSD-src-0a21f474dc2916335177c20f10de96a7a093926e.tar.gz
Close a race between a thread exiting and the freeing of it's stack.
After some discussion the best option seems to be to signal the thread's death from within the kernel. This requires that thr_exit() take an argument. Discussed with: davidxu, deischen, marcel MFC after: 3 days
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r--sys/kern/kern_thr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 6a5f220..402667a 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -186,12 +186,16 @@ thr_self(struct thread *td, struct thr_self_args *uap)
int
thr_exit(struct thread *td, struct thr_exit_args *uap)
- /* NULL */
+ /* long *state */
{
struct proc *p;
p = td->td_proc;
+ /* Signal userland that it can free the stack. */
+ if ((void *)uap->state != NULL)
+ suword((void *)uap->state, 1);
+
PROC_LOCK(p);
mtx_lock_spin(&sched_lock);
OpenPOWER on IntegriCloud