|
Scott Talbert |
181aaf |
From f97e07ea807cc6d38774a3888a15091b20645ac6 Mon Sep 17 00:00:00 2001
|
|
Scott Talbert |
181aaf |
From: Paul Eggert <eggert@cs.ucla.edu>
|
|
Scott Talbert |
181aaf |
Date: Tue, 9 Mar 2021 11:22:59 -0800
|
|
Scott Talbert |
181aaf |
Subject: [PATCH] Port alternate signal stack to upcoming glibc 2.34
|
|
Scott Talbert |
181aaf |
MIME-Version: 1.0
|
|
Scott Talbert |
181aaf |
Content-Type: text/plain; charset=UTF-8
|
|
Scott Talbert |
181aaf |
Content-Transfer-Encoding: 8bit
|
|
Scott Talbert |
181aaf |
|
|
Scott Talbert |
181aaf |
* src/sysdep.c (sigsegv_stack): Increase size to 64 KiB and align
|
|
Scott Talbert |
181aaf |
it to max_align_t. This copies from Gnulib’s c-stack.c, and works
|
|
Scott Talbert |
181aaf |
around a portability bug in draft glibc 2.34, which no longer
|
|
Scott Talbert |
181aaf |
defines SIGSTKSZ when _GNU_SOURCE is defined.
|
|
Scott Talbert |
181aaf |
---
|
|
Scott Talbert |
181aaf |
src/sysdep.c | 10 +++++++++-
|
|
Scott Talbert |
181aaf |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
Scott Talbert |
181aaf |
|
|
Scott Talbert |
181aaf |
diff --git a/src/sysdep.c b/src/sysdep.c
|
|
Scott Talbert |
181aaf |
index 941b4e2fa2..24d8832b2f 100644
|
|
Scott Talbert |
181aaf |
--- a/src/sysdep.c
|
|
Scott Talbert |
181aaf |
+++ b/src/sysdep.c
|
|
Scott Talbert |
181aaf |
@@ -1785,7 +1785,15 @@ handle_arith_signal (int sig)
|
|
Scott Talbert |
181aaf |
|
|
Scott Talbert |
181aaf |
/* Alternate stack used by SIGSEGV handler below. */
|
|
Scott Talbert |
181aaf |
|
|
Scott Talbert |
181aaf |
-static unsigned char sigsegv_stack[SIGSTKSZ];
|
|
Scott Talbert |
181aaf |
+/* Storage for the alternate signal stack.
|
|
Scott Talbert |
181aaf |
+ 64 KiB is not too large for Emacs, and is large enough
|
|
Scott Talbert |
181aaf |
+ for all known platforms. Smaller sizes may run into trouble.
|
|
Scott Talbert |
181aaf |
+ For example, libsigsegv 2.6 through 2.8 have a bug where some
|
|
Scott Talbert |
181aaf |
+ architectures use more than the Linux default of an 8 KiB alternate
|
|
Scott Talbert |
181aaf |
+ stack when deciding if a fault was caused by stack overflow. */
|
|
Scott Talbert |
181aaf |
+static max_align_t sigsegv_stack[(64 * 1024
|
|
Scott Talbert |
181aaf |
+ + sizeof (max_align_t) - 1)
|
|
Scott Talbert |
181aaf |
+ / sizeof (max_align_t)];
|
|
Scott Talbert |
181aaf |
|
|
Scott Talbert |
181aaf |
|
|
Scott Talbert |
181aaf |
/* Return true if SIGINFO indicates a stack overflow. */
|
|
Scott Talbert |
181aaf |
--
|
|
Scott Talbert |
181aaf |
2.29.2
|
|
Scott Talbert |
181aaf |
|