From owner-cvs-all Tue Jan 18 23: 4:56 2000 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 32C721518F; Tue, 18 Jan 2000 23:04:53 -0800 (PST) (envelope-from jasone@FreeBSD.org) Received: (from jasone@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id XAA84180; Tue, 18 Jan 2000 23:04:52 -0800 (PST) (envelope-from jasone@FreeBSD.org) Message-Id: <200001190704.XAA84180@freefall.freebsd.org> From: Jason Evans Date: Tue, 18 Jan 2000 23:04:52 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc_r/uthread uthread_jmp.c Makefile.inc pthread_private.h uthread_cancel.c uthread_cond.c uthread_create.c uthread_fd.c uthread_file.c uthread_init.c uthread_join.c uthread_kern.c uthread_mutex.c uthread_priority_queue.c ... Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk jasone 2000/01/18 23:04:52 PST Modified files: lib/libc_r/uthread Makefile.inc pthread_private.h uthread_cancel.c uthread_cond.c uthread_create.c uthread_fd.c uthread_file.c uthread_init.c uthread_join.c uthread_kern.c uthread_mutex.c uthread_priority_queue.c uthread_setprio.c uthread_sig.c Added files: lib/libc_r/uthread uthread_jmp.c Log: 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 Revision Changes Path 1.21 +2 -1 src/lib/libc_r/uthread/Makefile.inc 1.33 +53 -2 src/lib/libc_r/uthread/pthread_private.h 1.3 +19 -5 src/lib/libc_r/uthread/uthread_cancel.c 1.21 +21 -13 src/lib/libc_r/uthread/uthread_cond.c 1.24 +27 -13 src/lib/libc_r/uthread/uthread_create.c 1.16 +9 -17 src/lib/libc_r/uthread/uthread_fd.c 1.12 +4 -7 src/lib/libc_r/uthread/uthread_file.c 1.23 +13 -1 src/lib/libc_r/uthread/uthread_init.c 1.12 +4 -6 src/lib/libc_r/uthread/uthread_join.c 1.27 +45 -5 src/lib/libc_r/uthread/uthread_kern.c 1.20 +4 -6 src/lib/libc_r/uthread/uthread_mutex.c 1.5 +2 -2 src/lib/libc_r/uthread/uthread_priority_queue.c 1.7 +1 -2 src/lib/libc_r/uthread/uthread_setprio.c 1.24 +196 -18 src/lib/libc_r/uthread/uthread_sig.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message