guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch core-updates updated: gnu: camlboot: Fix signal handling with new


From: guix-commits
Subject: branch core-updates updated: gnu: camlboot: Fix signal handling with newer glibc.
Date: Sun, 19 Feb 2023 17:01:18 -0500

This is an automated email from the git hooks/post-receive script.

roptat pushed a commit to branch core-updates
in repository guix.

The following commit(s) were added to refs/heads/core-updates by this push:
     new b1a0b5a3f5 gnu: camlboot: Fix signal handling with newer glibc.
b1a0b5a3f5 is described below

commit b1a0b5a3f52c247605893aca27f1d9e733ed26d1
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Sun Feb 19 22:54:10 2023 +0100

    gnu: camlboot: Fix signal handling with newer glibc.
    
    * gnu/packages/patches/camlboot-dynamically-allocate-stack-signal.patch:
      New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/ocaml.scm (camlboot): Use it.
---
 gnu/local.mk                                       |  1 +
 gnu/packages/ocaml.scm                             |  2 +
 ...amlboot-dynamically-allocate-stack-signal.patch | 52 ++++++++++++++++++++++
 3 files changed, 55 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index c52bcb3ecc..44231b3095 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -958,6 +958,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/calibre-no-updates-dialog.patch         \
   %D%/packages/patches/calibre-remove-test-sqlite.patch                \
   %D%/packages/patches/calibre-remove-test-unrar.patch         \
+  %D%/packages/patches/camlboot-dynamically-allocate-stack-signal.patch        
\
   %D%/packages/patches/catdoc-CVE-2017-11110.patch             \
   %D%/packages/patches/chez-scheme-bin-sh.patch                        \
   %D%/packages/patches/circos-remove-findbin.patch             \
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 1487ed9337..8e7fb58c72 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -133,6 +133,8 @@
                 (sha256
                  (base32
                   "1f5gl3hzvixbgk0v3kmxiyn432znyy3jh5fa65cfzcaxzgfv1i1c"))
+                (patches (search-patches
+                           "camlboot-dynamically-allocate-stack-signal.patch"))
                 (modules '((guix build utils)))
                 (snippet
                  `(begin
diff --git 
a/gnu/packages/patches/camlboot-dynamically-allocate-stack-signal.patch 
b/gnu/packages/patches/camlboot-dynamically-allocate-stack-signal.patch
new file mode 100644
index 0000000000..d27232214b
--- /dev/null
+++ b/gnu/packages/patches/camlboot-dynamically-allocate-stack-signal.patch
@@ -0,0 +1,52 @@
+From 883d68803d17d6f64cdabf2c8ef846345e2d0094 Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sun, 19 Feb 2023 10:20:19 +0100
+Subject: [PATCH] Dynamically allocate the alternate signal stack.
+
+This patch is a backport of https://github.com/ocaml/ocaml/pull/10266.
+---
+ ocaml-src/asmrun/signals_asm.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/ocaml-src/asmrun/signals_asm.c b/ocaml-src/asmrun/signals_asm.c
+index 3895d75..d37b481 100644
+--- a/ocaml-src/asmrun/signals_asm.c
++++ b/ocaml-src/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
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]