freebsd-dev/lib/libpthread/thread
Jason Evans 0a3fa43c7e Implement continuations to correctly handle [sig|_]longjmp() inside of a
signal handler.  Explicitly check for jumps to anywhere other than the
current stack, since such jumps are undefined according to POSIX.

While we're at it, convert thread cancellation to use continuations, since
it's cleaner than the original cancellation code.

Avoid delivering a signal to a thread twice.  This was a pre-existing bug,
but was likely unexposed until these other changes were made.

Defer signals generated by pthread_kill() so that they can be delivered on
the appropriate stack.  deischen claims that this is unnecessary, which is
likely true, but without this change, pthread_kill() can cause undefined
priority queue states and/or PANICs in [sig|_]longjmp(), so I'm leaving
this in for now.  To compile this code out and exercise the bug, define
the _NO_UNDISPATCH cpp macro.  Defining _PTHREADS_INVARIANTS as well will
cause earlier crashes.

PR:			kern/14685
Collaboration with:	deischen
2000-01-19 07:04:50 +00:00
..
Makefile.inc Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_attr_destroy.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_getdetachstate.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_getinheritsched.c add pthread_cancel, obtained from OpenBSD. 1999-11-28 05:38:13 +00:00
thr_attr_getschedparam.c add pthread_cancel, obtained from OpenBSD. 1999-11-28 05:38:13 +00:00
thr_attr_getschedpolicy.c add pthread_cancel, obtained from OpenBSD. 1999-11-28 05:38:13 +00:00
thr_attr_getscope.c add pthread_cancel, obtained from OpenBSD. 1999-11-28 05:38:13 +00:00
thr_attr_getstackaddr.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_getstacksize.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_init.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_setcreatesuspend_np.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_setdetachstate.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_attr_setinheritsched.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_setschedparam.c Make sched_param parameter a const to comply with POSIX and SUSv2 specs. 2000-01-10 04:14:08 +00:00
thr_attr_setschedpolicy.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_setscope.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_attr_setstackaddr.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_attr_setstacksize.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_cancel.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_clean.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_close.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_cond.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_condattr_destroy.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_condattr_init.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_create.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_detach.c -Wall and minor style(9) cleanups. 1999-12-28 18:13:04 +00:00
thr_equal.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_exit.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_fcntl.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_find_thread.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_fork.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_fsync.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_gc.c -Wall and minor style(9) cleanups. 1999-12-28 18:13:04 +00:00
thr_getprio.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_getschedparam.c add pthread_cancel, obtained from OpenBSD. 1999-11-28 05:38:13 +00:00
thr_info.c sigset_t change (part 5 of 5) 1999-09-29 15:18:46 +00:00
thr_init.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_join.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_kern.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_kill.c Fixes for signal handling: 1999-12-17 00:56:36 +00:00
thr_mattr_init.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_mattr_kind_np.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_msync.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_multi_np.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_mutex_prioceiling.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_mutex_protocol.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_mutex.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_mutexattr_destroy.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_nanosleep.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_once.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_open.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_poll.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_priority_queue.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_private.h Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_read.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_readv.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_resume_np.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_rwlock.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_rwlockattr.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_select.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_self.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_seterrno.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_setprio.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_setschedparam.c -Wall and minor style(9) cleanups. 1999-12-28 18:13:04 +00:00
thr_sig.c Implement continuations to correctly handle [sig|_]longjmp() inside of a 2000-01-19 07:04:50 +00:00
thr_sigaction.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_sigmask.c sigset_t change (part 5 of 5) 1999-09-29 15:18:46 +00:00
thr_sigpending.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_sigprocmask.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_sigsuspend.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_sigwait.c Change signal handling to conform to POSIX specified semantics. 1999-12-04 22:55:59 +00:00
thr_single_np.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_spec.c -Wall and minor style(9) cleanups. 1999-12-28 18:13:04 +00:00
thr_spinlock.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_suspend_np.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_switch_np.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
thr_vfork.c In libc_r, rename vfork syscall to _thread_sys_vfork and make vfork an alias 1998-09-12 22:03:20 +00:00
thr_wait4.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_write.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_writev.c Track libc's three-tier symbol naming. libc_r must currently implement 2000-01-12 09:28:58 +00:00
thr_yield.c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00