about summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-20 19:19:50 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-20 23:28:16 +0100
commit49b308a26e2a9e02ef396f67f59c462ad4171ea4 (patch)
treee4705638a64da583bbe578896dbb5f8b5fa70333 /hurd
parent3cbaacdfd2c11cb726011ef6464dce00c186a2bf (diff)
downloadglibc-49b308a26e2a9e02ef396f67f59c462ad4171ea4.tar.gz
glibc-49b308a26e2a9e02ef396f67f59c462ad4171ea4.tar.xz
glibc-49b308a26e2a9e02ef396f67f59c462ad4171ea4.zip
hurd: Prevent the final file_exec_paths call from signals
Otherwise if the exec server started thrashing the old task,
we won't be able to restart the exec.

This notably fixes building ghc.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdexec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c
index e358d846c8..317d7ea0ad 100644
--- a/hurd/hurdexec.c
+++ b/hurd/hurdexec.c
@@ -362,6 +362,7 @@ retry:
   if (!err)
     {
       int flags;
+      sigset_t old, new;
 
       if (pdp)
 	{
@@ -420,6 +421,15 @@ retry:
       if (__sigismember (&_hurdsig_traced, SIGKILL))
 	flags |= EXEC_SIGTRAP;
 #endif
+
+     /* Avoid getting interrupted while exec(), notably not after the exec
+        server has committed to the exec and started thrashing us.
+
+        TODO Rather add proper interrupt support to the exec server, that
+        avoids interrupts in that period.  */
+      __sigfillset (&new);
+      __sigprocmask (SIG_SETMASK, &new, &old);
+
       err = __file_exec_paths (file, task, flags,
 			       path ? path : "",
 			       abspath ? abspath : "",
@@ -440,6 +450,8 @@ retry:
 			   ints, INIT_INT_MAX,
 			   please_dealloc, pdp - please_dealloc,
 			   portnames, nportnames);
+
+      __sigprocmask (SIG_SETMASK, &old, NULL);
     }
 
   /* Release references to the standard ports.  */