Skip to content

Commit f97e07e

Browse files
committed
Port alternate signal stack to upcoming glibc 2.34
* 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.
1 parent c6ed17c commit f97e07e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/sysdep.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,15 @@ handle_arith_signal (int sig)
17851785

17861786
/* Alternate stack used by SIGSEGV handler below. */
17871787

1788-
static unsigned char sigsegv_stack[SIGSTKSZ];
1788+
/* Storage for the alternate signal stack.
1789+
64 KiB is not too large for Emacs, and is large enough
1790+
for all known platforms. Smaller sizes may run into trouble.
1791+
For example, libsigsegv 2.6 through 2.8 have a bug where some
1792+
architectures use more than the Linux default of an 8 KiB alternate
1793+
stack when deciding if a fault was caused by stack overflow. */
1794+
static max_align_t sigsegv_stack[(64 * 1024
1795+
+ sizeof (max_align_t) - 1)
1796+
/ sizeof (max_align_t)];
17891797

17901798

17911799
/* Return true if SIGINFO indicates a stack overflow. */

0 commit comments

Comments
 (0)