From 95f5016955e519c392c746e38e0c9460f2c1aa0c Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sun, 19 Feb 2023 09:58:57 +0100 Subject: [PATCH] Dynamically allocate the alternate signal stack. This patch is a backport of https://github.com/ocaml/ocaml/pull/10266. --- runtime/signals_nat.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/runtime/signals_nat.c b/runtime/signals_nat.c index 29a5f49..a193fc2 100644 --- a/runtime/signals_nat.c +++ b/runtime/signals_nat.c @@ -182,7 +182,6 @@ DECLARE_SIGNAL_HANDLER(trap_handler) #ifdef HAS_STACK_OVERFLOW_DETECTION static char * system_stack_top; -static char sig_alt_stack[SIGSTKSZ]; #if defined(SYS_linux) /* PR#4746: recent Linux kernels with support for stack randomization @@ -274,15 +273,19 @@ void caml_init_signals(void) #ifdef HAS_STACK_OVERFLOW_DETECTION { stack_t stk; - struct sigaction act; - stk.ss_sp = sig_alt_stack; + stk.ss_sp = malloc(SIGSTKSZ); stk.ss_size = SIGSTKSZ; stk.ss_flags = 0; - SET_SIGACT(act, segv_handler); - act.sa_flags |= SA_ONSTACK | SA_NODEFER; - sigemptyset(&act.sa_mask); - system_stack_top = (char *) &act; - if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); } + if (stk.ss_sp != NULL) { + if (sigaltstack(&stk, NULL) != -1) { + struct sigaction act; + SET_SIGACT(act, segv_handler); + act.sa_flags |= SA_ONSTACK | SA_NODEFER; + sigemptyset(&act.sa_mask); + system_stack_top = (char *) &act; + sigaction(SIGSEGV, &act, NULL); + } + } } #endif } -- 2.38.1
path: root/bootstrap
AgeCommit message (Expand)Author
2020-02-17bootstrap: Fix typo....* bootstrap: Substitute ‘guix-cookbook’ for copy/pasted ‘guix-manual’. Reported-by: jetomit on #guix Tobias Geerinckx-Rice
2019-09-18doc: Add Guix Cookbook....* .gitignore: Update ignore list. * Makefile.am (assert-no-store-file-names): Exclude the cookbook. * bootstrap: Generate po files for cookbook translations. * doc/guix-cookbook.texi: New file. * doc/local.mk (info_TEXINFOS): Add it; add a rule to build cookbook translations. * po/doc/local.mk (DOC_COOKBOOK_PO_FILES): New variable. (EXTRA_DIST): Add cookbook pot file and po files. (doc-po-update-cookbook-%): New target. (doc-pot-update): Also update cookbook pot file. (doc-po-update): Also update cookbook po files. Ricardo Wurmus
2019-04-26bootstrap: Break automake dependency on generated files....* bootstrap: Generate stub files for the manual translations whose generated files are not included in the VCS. * doc/contributing.de.texi: Remove file. * doc/contributing.es.texi: Remove file. * doc/contributing.fr.texi: Remove file. * doc/contributing.zh_CN.texi: Remove file. * doc/guix.de.texi: Remove file. * doc/guix.es.texi: Remove file. * doc/guix.fr.texi: Remove file. * doc/guix.zh_CN.texi: Remove file. * .gitignore: Add them. Signed-off-by: Julien Lepiller <julien@lepiller.eu> Miguel Ángel Arruga Vivas