From 619189958917e80786d5bb2efa4dc38d908d2553 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Tue, 17 Mar 2009 11:27:08 +0000 Subject: [PATCH] 1.0.26.7: use a signal for SIG_STOP_FOR_GC > SIGSEGV on Linux On Linux a signal generated by pthread_kill() with a signum that's lower than SIGSEGV can be delivered before a synchronously triggered SIGSEGV. This means that the sigsegv handler will be invoked with its context pointing to the handler for the signal that pthread_kill() sent. It's not really specific to SIGSEGV, it's the same for any synchronously generated signal. To work around this, we must never pthread_kill() with a signal with a lower signum than any of the synchronously triggered signals that we use: SIGTRAP, SIGSEGV, etc. In practice, currently we only send SIGPIPE to indicate that the thread interruption queue may need to be looked at and SIG_STOP_FOR_GC that's defined as SIGUSR1 currently. With SIGUSR1 being 10 and SIGSEGV 11 this can make handle_guard_page_triggered lose badly if GC wants to stop the thread at the same time. So let's use SIGUSR2 instead that's 12. Do the same on other OSes they may have same bug. See thread "Signal delivery order" from 2009-03-14 on kernel-devel@vger.kernel.org: http://groups.google.com/group/fa.linux.kernel/browse_thread/thread/6773ac3dcb867da3# --- src/runtime/bsd-os.h | 2 +- src/runtime/darwin-os.h | 2 +- src/runtime/linux-os.h | 2 +- src/runtime/sunos-os.h | 2 +- version.lisp-expr | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/bsd-os.h b/src/runtime/bsd-os.h index 0f5a4b9..26e39e3 100644 --- a/src/runtime/bsd-os.h +++ b/src/runtime/bsd-os.h @@ -59,7 +59,7 @@ typedef ucontext_t os_context_t; extern int sig_memory_fault; #define SIG_MEMORY_FAULT (sig_memory_fault) -#define SIG_STOP_FOR_GC (SIGUSR1) +#define SIG_STOP_FOR_GC (SIGUSR2) #elif defined __OpenBSD__ diff --git a/src/runtime/darwin-os.h b/src/runtime/darwin-os.h index 35cc0fc..b78f470 100644 --- a/src/runtime/darwin-os.h +++ b/src/runtime/darwin-os.h @@ -33,6 +33,6 @@ typedef ucontext_t os_context_t; #define SIG_MEMORY_FAULT SIGBUS -#define SIG_STOP_FOR_GC (SIGUSR1) +#define SIG_STOP_FOR_GC (SIGUSR2) #endif /* _DARWIN_OS_H */ diff --git a/src/runtime/linux-os.h b/src/runtime/linux-os.h index f0387e9..f1a84e9 100644 --- a/src/runtime/linux-os.h +++ b/src/runtime/linux-os.h @@ -39,4 +39,4 @@ typedef int os_vm_prot_t; #define SIG_MEMORY_FAULT SIGSEGV -#define SIG_STOP_FOR_GC (SIGUSR1) +#define SIG_STOP_FOR_GC (SIGUSR2) diff --git a/src/runtime/sunos-os.h b/src/runtime/sunos-os.h index acb827a..7ca04b9 100644 --- a/src/runtime/sunos-os.h +++ b/src/runtime/sunos-os.h @@ -32,7 +32,7 @@ typedef int os_vm_prot_t; #define SIG_MEMORY_FAULT SIGSEGV -#define SIG_STOP_FOR_GC (SIGUSR1) +#define SIG_STOP_FOR_GC (SIGUSR2) /* Yaargh?! */ typedef int os_context_register_t ; diff --git a/version.lisp-expr b/version.lisp-expr index 4d5461a..27ef673 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".) -"1.0.26.6" +"1.0.26.7" -- 1.7.10.4