summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2004-04-13 01:09:55 +0000
committermarc <marc@openbsd.org>2004-04-13 01:09:55 +0000
commit8d69e483eea99970d48b94c7e4427aa1bc58aea0 (patch)
treeedb442a055db15a23ff09caedbcd7456da1e90ec /lib/libpthread
parentcommented out LoadModule statement for mod_proxy like we do for the other (diff)
downloadwireguard-openbsd-8d69e483eea99970d48b94c7e4427aa1bc58aea0.tar.xz
wireguard-openbsd-8d69e483eea99970d48b94c7e4427aa1bc58aea0.zip
refresh curthread after a thread switch so it points to the real
current thread. ok deraadt@
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/uthread/uthread_kern.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c
index c14810d0943..0b907306f1f 100644
--- a/lib/libpthread/uthread/uthread_kern.c
+++ b/lib/libpthread/uthread/uthread_kern.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_kern.c,v 1.28 2004/04/09 23:57:17 brad Exp $ */
+/* $OpenBSD: uthread_kern.c,v 1.29 2004/04/13 01:09:55 marc Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -470,6 +470,16 @@ _thread_kern_sched(struct sigcontext * scp)
/* Restore the new thread, saving current. */
_thread_machdep_switch(&curthread->_machdep,
&old_thread_run->_machdep);
+
+ /*
+ * DANGER WILL ROBINSON
+ * All stack local variables now contain the values
+ * they had when this thread was last running. In
+ * particular, curthread is NOT pointing to the
+ * current thread. Make it point to the current
+ * before use.
+ */
+ curthread = _get_curthread();
_thread_kern_in_sched = 0;
/* run any installed switch-hooks */