From b44ca02cb963446ef23fec989786462ce88bca84 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Fri, 14 Oct 2005 14:11:29 +0000 Subject: [PATCH] 0.9.5.58: * nasty interrupt bug: 1) sigalrm handler is deferred 2) later it's run via sigtrap handler 3) handler does pa_alloc while sigtrap is blocked 4) gc is needed and another sigtrap is triggered by 3) 5) stupid Linux kernel sees that sigtrap is blocked and invokes the default handler (see http://groups.google.com/group/fa.linux.kernel/browse_frm/thread/455401a6837c72bf/865ea792a236299c) 6) coredump Adding SA_NODEFER to sigaction is enough for sane systems to fix this. Not for buggy Linux 2.6. A compile time test was added for sigaction and SA_NODEFER allowing the runtime to work around this bug (see interrupt.c). * added missing sigemptysets --- src/runtime/interrupt.c | 46 +++++++++++++++--- tools-for-build/Makefile | 8 ++-- tools-for-build/grovel-features.sh | 4 +- tools-for-build/sigaction-sa-nodefer-works-test.c | 53 +++++++++++++++++++++ version.lisp-expr | 2 +- 5 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 tools-for-build/sigaction-sa-nodefer-works-test.c diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index 9c63983..d8c818a 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -118,7 +118,7 @@ check_blockables_blocked_or_lose() int i; sigemptyset(&empty); thread_sigmask(SIG_BLOCK, &empty, ¤t); - for(i=0;i /dev/null # FIXME: Use this to test for dlopen presence and hence @@ -24,3 +24,5 @@ featurep os-provides-dlopen featurep os-provides-dladdr featurep os-provides-putwc + +featurep sigaction-sa-nodefer-works diff --git a/tools-for-build/sigaction-sa-nodefer-works-test.c b/tools-for-build/sigaction-sa-nodefer-works-test.c new file mode 100644 index 0000000..5208f48 --- /dev/null +++ b/tools-for-build/sigaction-sa-nodefer-works-test.c @@ -0,0 +1,53 @@ +/* + * See if SA_NODEFER makes sigaction ignore sa_mask + * altogether. According to POSIX SA_NODEFER means: 'don't add the + * handler's signal to the mask'. + */ + +/* + * This software is part of the SBCL system. See the README file for + * more information. + * + * While most of SBCL is derived from the CMU CL system, many + * utilities for the build process (like this one) were written from + * scratch after the fork from CMU CL. + * + * This software is in the public domain and is provided with + * absolutely no warranty. See the COPYING and CREDITS files for + * more information. + */ + +#include +#include +#include +#include +#include +#include +#include + +void +handler(int signal, siginfo_t *info, void *void_context) +{ + sigset_t empty, current; + int i; + sigemptyset(&empty); + sigprocmask(SIG_BLOCK, &empty, ¤t); + for(i = 1; i < NSIG; i++) + if (sigismember(¤t, i) != ((i == SIGABRT) ? 1 : 0)) + exit(128 + i); + exit(104); +} + +int +main (int argc, char *argv[]) +{ + struct sigaction sa; + + sa.sa_flags = SA_SIGINFO | SA_NODEFER; + sa.sa_sigaction = handler; + sigemptyset(&sa.sa_mask); + sigaddset(&sa.sa_mask, SIGABRT); + sigaction(SIGTRAP, &sa, NULL); + kill(getpid(), SIGTRAP); + while (1) sleep(1); +} diff --git a/version.lisp-expr b/version.lisp-expr index 4a505c3..2b1b4e0 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.5.57" +"0.9.5.58" -- 1.7.10.4