aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2021-03-09 11:22:59 -0800
committerStefan Kangas2022-07-15 13:37:40 +0200
commit647a9353a35bb6f97a8494f1765400f8a34081ea (patch)
treef869e16440cf0bc67d491d2a416c4d669670ce58
parentd7f4cc0974645cc6a295740afe85c6e21d956119 (diff)
downloademacs-27.tar.gz
emacs-27.zip
Port alternate signal stack to upcoming glibc 2.34emacs-27
* src/sysdep.c (sigsegv_stack): Increase size to 64 KiB and align it to max_align_t. This copies from Gnulib’s c-stack.c, and works around a portability bug in draft glibc 2.34, which no longer defines SIGSTKSZ when _GNU_SOURCE is defined. (cherry picked from commit f97e07ea807cc6d38774a3888a15091b20645ac6)
-rw-r--r--src/sysdep.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index d100a5cb50b..f0b97767ba4 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1818,7 +1818,15 @@ handle_arith_signal (int sig)
1818 1818
1819/* Alternate stack used by SIGSEGV handler below. */ 1819/* Alternate stack used by SIGSEGV handler below. */
1820 1820
1821static unsigned char sigsegv_stack[SIGSTKSZ]; 1821/* Storage for the alternate signal stack.
1822 64 KiB is not too large for Emacs, and is large enough
1823 for all known platforms. Smaller sizes may run into trouble.
1824 For example, libsigsegv 2.6 through 2.8 have a bug where some
1825 architectures use more than the Linux default of an 8 KiB alternate
1826 stack when deciding if a fault was caused by stack overflow. */
1827static max_align_t sigsegv_stack[(64 * 1024
1828 + sizeof (max_align_t) - 1)
1829 / sizeof (max_align_t)];
1822 1830
1823 1831
1824/* Return true if SIGINFO indicates a stack overflow. */ 1832/* Return true if SIGINFO indicates a stack overflow. */