From c07b621a73f9580a32d27d94e301c01c5dad5f4e Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Mon, 9 Sep 2013 03:19:18 +0400 Subject: [PATCH] sb-safepoint: Fix interrupts during GC. In interrupt_handle_now, move context_sap = alloc_sap(context); info_sap = alloc_sap(info); after WITH_GC_AT_SAFEPOINTS_ONLY(), otherwise the allocation will break the running GC. Fixes lp#1133018. --- NEWS | 3 +++ src/runtime/interrupt.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index b7cc955..6c1f71e 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ changes relative to sbcl-1.1.11: (thanks to Stephan Frank) * bug fix: space allocation of result bignums in SB-GMP is more accurate. (thanks to Stephan Frank, lp#1206191) + * bug fix: sb-safepoint can now reliably handle signal interruptions of + foreign code. (lp#1133018) + changes in sbcl-1.1.11 relative to sbcl-1.1.10: * enhancement: support building the manual under texinfo version 5. diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index 882e2bb..7497d2b 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -1084,9 +1084,12 @@ interrupt_handle_now(int signal, siginfo_t *info, os_context_t *context) * in PA. MG - 2005-08-29 */ lispobj info_sap, context_sap; + +#ifdef LISP_FEATURE_SB_SAFEPOINT + WITH_GC_AT_SAFEPOINTS_ONLY() +#else /* Leave deferrable signals blocked, the handler itself will * allow signals again when it sees fit. */ -#ifndef LISP_FEATURE_SB_SAFEPOINT unblock_gc_signals(0, 0); #endif context_sap = alloc_sap(context); @@ -1094,9 +1097,6 @@ interrupt_handle_now(int signal, siginfo_t *info, os_context_t *context) FSHOW_SIGNAL((stderr,"/calling Lisp-level handler\n")); -#ifdef LISP_FEATURE_SB_SAFEPOINT - WITH_GC_AT_SAFEPOINTS_ONLY() -#endif funcall3(handler.lisp, make_fixnum(signal), info_sap, -- 1.7.10.4