|
| 1 | +diff --git bazel/m4.patch bazel/m4.patch |
| 2 | +index 544cbaa..c536bdc 100644 |
| 3 | +--- bazel/m4.patch |
| 4 | ++++ bazel/m4.patch |
| 5 | +@@ -131,3 +131,97 @@ |
| 6 | + # else |
| 7 | + # define USE_SNPRINTF 0 |
| 8 | + # endif |
| 9 | ++diff --git lib/c-stack.c lib/c-stack.c |
| 10 | ++index 5353c08..a608fbe 100644 |
| 11 | ++--- lib/c-stack.c |
| 12 | +++++ lib/c-stack.c |
| 13 | ++@@ -50,16 +50,16 @@ |
| 14 | ++ #if ! HAVE_STACK_T && ! defined stack_t |
| 15 | ++ typedef struct sigaltstack stack_t; |
| 16 | ++ #endif |
| 17 | ++-#ifndef SIGSTKSZ |
| 18 | ++-# define SIGSTKSZ 16384 |
| 19 | ++-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384 |
| 20 | ++-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use |
| 21 | ++- more than the Linux default of an 8k alternate stack when deciding |
| 22 | ++- if a fault was caused by stack overflow. */ |
| 23 | ++-# undef SIGSTKSZ |
| 24 | ++-# define SIGSTKSZ 16384 |
| 25 | ++-#endif |
| 26 | ++- |
| 27 | +++/* Storage for the alternate signal stack. |
| 28 | +++ * 64 KiB is not too large for Gnulib-using apps, and is large enough |
| 29 | +++ * for all known platforms. Smaller sizes may run into trouble. |
| 30 | +++ * For example, libsigsegv 2.6 through 2.8 have a bug where some |
| 31 | +++ * architectures use more than the Linux default of an 8 KiB alternate |
| 32 | +++ * stack when deciding if a fault was caused by stack overflow. */ |
| 33 | +++static max_align_t alternate_signal_stack[(64 * 1024 |
| 34 | +++ + sizeof (max_align_t) - 1) |
| 35 | +++ / sizeof (max_align_t)]; |
| 36 | +++ |
| 37 | ++ #include <stdlib.h> |
| 38 | ++ #include <string.h> |
| 39 | ++ |
| 40 | ++@@ -128,18 +128,6 @@ die (int signo) |
| 41 | ++ #if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \ |
| 42 | ++ && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV |
| 43 | ++ |
| 44 | ++-/* Storage for the alternate signal stack. */ |
| 45 | ++-static union |
| 46 | ++-{ |
| 47 | ++- char buffer[SIGSTKSZ]; |
| 48 | ++- |
| 49 | ++- /* These other members are for proper alignment. There's no |
| 50 | ++- standard way to guarantee stack alignment, but this seems enough |
| 51 | ++- in practice. */ |
| 52 | ++- long double ld; |
| 53 | ++- long l; |
| 54 | ++- void *p; |
| 55 | ++-} alternate_signal_stack; |
| 56 | ++ |
| 57 | ++ static void |
| 58 | ++ null_action (int signo __attribute__ ((unused))) |
| 59 | ++@@ -205,8 +193,8 @@ c_stack_action (void (*action) (int)) |
| 60 | ++ |
| 61 | ++ /* Always install the overflow handler. */ |
| 62 | ++ if (stackoverflow_install_handler (overflow_handler, |
| 63 | ++- alternate_signal_stack.buffer, |
| 64 | ++- sizeof alternate_signal_stack.buffer)) |
| 65 | +++ alternate_signal_stack, |
| 66 | +++ sizeof alternate_signal_stack)) |
| 67 | ++ { |
| 68 | ++ errno = ENOTSUP; |
| 69 | ++ return -1; |
| 70 | ++@@ -279,14 +267,14 @@ c_stack_action (void (*action) (int)) |
| 71 | ++ stack_t st; |
| 72 | ++ struct sigaction act; |
| 73 | ++ st.ss_flags = 0; |
| 74 | +++ st.ss_sp = alternate_signal_stack; |
| 75 | +++ st.ss_size = sizeof alternate_signal_stack; |
| 76 | ++ # if SIGALTSTACK_SS_REVERSED |
| 77 | ++ /* Irix mistakenly treats ss_sp as the upper bound, rather than |
| 78 | ++ lower bound, of the alternate stack. */ |
| 79 | ++- st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *); |
| 80 | ++- st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *); |
| 81 | ++-# else |
| 82 | ++- st.ss_sp = alternate_signal_stack.buffer; |
| 83 | ++- st.ss_size = sizeof alternate_signal_stack.buffer; |
| 84 | +++ st.ss_size -= sizeof (void *); |
| 85 | +++ char *ss_sp = st.ss_sp; |
| 86 | +++ st.ss_sp = ss_sp + st.ss_size; |
| 87 | ++ # endif |
| 88 | ++ r = sigaltstack (&st, NULL); |
| 89 | ++ if (r != 0) |
| 90 | ++diff --git lib/c-stack.h lib/c-stack.h |
| 91 | ++index efd3b8f..df8a790 100644 |
| 92 | ++--- lib/c-stack.h |
| 93 | +++++ lib/c-stack.h |
| 94 | ++@@ -34,7 +34,7 @@ |
| 95 | ++ A null ACTION acts like an action that does nothing. |
| 96 | ++ |
| 97 | ++ ACTION must be async-signal-safe. ACTION together with its callees |
| 98 | ++- must not require more than SIGSTKSZ bytes of stack space. Also, |
| 99 | +++ must not require more than 64 KiB of stack space. Also, |
| 100 | ++ ACTION should not call longjmp, because this implementation does |
| 101 | ++ not guarantee that it is safe to return to the original stack. |
| 102 | ++ |
| 103 | + |
0 commit comments