diff options
author | Julien Lepiller <julien@lepiller.eu> | 2023-02-22 08:20:12 +0100 |
---|---|---|
committer | Julien Lepiller <julien@lepiller.eu> | 2023-02-22 08:21:22 +0100 |
commit | ca0f9d8c1cf19757b1a1b525421617749417d1f2 (patch) | |
tree | bfe6edef6edc8cab41f2776fad0d197a1cad91d7 /gnu | |
parent | 78a1eee08932e4512885f065d13472acc20e5970 (diff) | |
download | guix-ca0f9d8c1cf19757b1a1b525421617749417d1f2.tar.gz |
gnu: ocaml-4.07: Fix signal handling with newer glibc.
* gnu/packages/patches/ocaml-4.07-dynamically-allocate-signal-stack.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/ocaml.scm (ocaml-4.07-boot): Use it.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/ocaml.scm | 4 | ||||
-rw-r--r-- | gnu/packages/patches/ocaml-4.07-dynamically-allocate-signal-stack.patch | 52 |
3 files changed, 56 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 44231b3095..dfe78412e0 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1581,6 +1581,7 @@ dist_patch_DATA = \ %D%/packages/patches/ocaml-dose3-dont-make-printconf.patch \ %D%/packages/patches/ocaml-dose3-Install-mli-cmx-etc.patch \ %D%/packages/patches/ocaml-multiple-definitions.patch \ + %D%/packages/patches/ocaml-4.07-dynamically-allocate-signal-stack.patch \ %D%/packages/patches/ocaml-4.09-dynamically-allocate-signal-stack.patch \ %D%/packages/patches/ocaml-4.09-multiple-definitions.patch \ %D%/packages/patches/omake-fix-non-determinism.patch \ diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index 8e7fb58c72..ac31d71fcf 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -369,7 +369,9 @@ patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%" (sha256 (base32 "1f07hgj5k45cylj1q3k5mk8yi02cwzx849b1fwnwia8xlcfqpr6z")) - (patches (search-patches "ocaml-multiple-definitions.patch")) + (patches (search-patches + "ocaml-multiple-definitions.patch" + "ocaml-4.07-dynamically-allocate-signal-stack.patch")) (modules '((guix build utils))) (snippet `(begin diff --git a/gnu/packages/patches/ocaml-4.07-dynamically-allocate-signal-stack.patch b/gnu/packages/patches/ocaml-4.07-dynamically-allocate-signal-stack.patch new file mode 100644 index 0000000000..a8144b85e6 --- /dev/null +++ b/gnu/packages/patches/ocaml-4.07-dynamically-allocate-signal-stack.patch @@ -0,0 +1,52 @@ +From 5a224b981ee32d7cf59aaa9e2c101af65a275edc Mon Sep 17 00:00:00 2001 +From: Julien Lepiller <julien@lepiller.eu> +Date: Mon, 20 Feb 2023 19:14:12 +0100 +Subject: [PATCH] Dynamically allocate the alternate signal stack. + +This patch is a backport of https://github.com/ocaml/ocaml/pull/10266. +--- + asmrun/signals_asm.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/asmrun/signals_asm.c b/asmrun/signals_asm.c +index 3895d75..7e2abe8 100644 +--- a/asmrun/signals_asm.c ++++ b/asmrun/signals_asm.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 + |