summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-07-20 21:23:21 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-07-20 21:23:21 -0700
commitec1b8794dd3fdbff6311d955b63df3b7b27038c9 (patch)
tree8260ff34a79481b53545a150fca3c83bc3fc16b5
parent636ad323c664f292802316c2da93767e9332f731 (diff)
downloadtxr-ec1b8794dd3fdbff6311d955b63df3b7b27038c9.tar.gz
txr-ec1b8794dd3fdbff6311d955b63df3b7b27038c9.tar.bz2
txr-ec1b8794dd3fdbff6311d955b63df3b7b27038c9.zip
* signal.c (set_sig_handler): Set up and tear down alternate
stack for SIGBUS also, not only for SIGSEGV. On Linux, when stack growth collides with another memory mapping, it triggers a SIGBUS not SIGSEGV, which occurs when the process limit on stack size is exceeded. In either situation, we need an alternative stack.
-rw-r--r--ChangeLog9
-rw-r--r--signal.c4
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 90346146..c986a5d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2014-07-20 Kaz Kylheku <kaz@kylheku.com>
+ * signal.c (set_sig_handler): Set up and tear down alternate
+ stack for SIGBUS also, not only for SIGSEGV. On Linux,
+ when stack growth collides with another memory mapping,
+ it triggers a SIGBUS not SIGSEGV, which occurs when the
+ process limit on stack size is exceeded. In either
+ situation, we need an alternative stack.
+
+2014-07-20 Kaz Kylheku <kaz@kylheku.com>
+
* eval.c (caseq_s, caseql_s, casequal_s, memq_s, memql_s, memqual_s,
eq_s, eql_s, equal_s): New symbol variables.
(me_case): New static function.
diff --git a/signal.c b/signal.c
index 086b0031..5072f09d 100644
--- a/signal.c
+++ b/signal.c
@@ -236,7 +236,7 @@ val set_sig_handler(val signo, val lambda)
sa.sa_handler = sig_handler;
sigfillset(&sa.sa_mask);
#if HAVE_SIGALTSTACK
- if (sig == SIGSEGV)
+ if (sig == SIGSEGV || sig == SIGBUS)
setup_alt_stack();
sa.sa_flags |= SA_ONSTACK;
#endif
@@ -244,7 +244,7 @@ val set_sig_handler(val signo, val lambda)
}
#if HAVE_SIGALTSTACK
- if (sig == SIGSEGV && (lambda == nil || lambda == t))
+ if ((sig == SIGSEGV || sig == SIGBUS) && (lambda == nil || lambda == t))
teardown_alt_stack();
#endif