summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-07-16 00:48:40 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-07-16 07:36:47 -0700
commita5522abbca2235771384949dfa87c8efc68831b2 (patch)
tree1e7f8ffd9a3ae3290672b8e6694696a37b0426fd /src/eval.c
parentbd8b5ac77250d9fe0634d58a30a3bf6d2497725a (diff)
downloademacs-a5522abbca2235771384949dfa87c8efc68831b2.tar.gz
Better heuristic for C stack overflow
Improve the heuristic for distinguishing stack overflows from other SIGSEGV causes (Bug#21004). Corinna Vinschen explained that the getrlimit method wasn't portable to Cygwin; see: https://www.cygwin.com/ml/cygwin/2015-07/msg00092.html Corinna suggested pthread_getattr_np but this also has problems. Instead, replace the low-level system stuff with a simple heuristic based on known good stack addresses. * src/eval.c, src/lisp.h (near_C_stack_top): New function. * src/sysdep.c: Don't include <sys/resource.h>. (stack_direction): Remove. All uses removed. (stack_overflow): New function. (handle_sigsegv): Use it instead of incorrect getrlimit heuristic. Make SEGV fatal in non-main threads.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index 4f7f42f1ebe..9bdcf4bed17 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -200,6 +200,12 @@ backtrace_next (union specbinding *pdl)
return pdl;
}
+/* Return a pointer to somewhere near the top of the C stack. */
+void *
+near_C_stack_top (void)
+{
+ return backtrace_args (backtrace_top ());
+}
void
init_eval_once (void)