From 49b308a26e2a9e02ef396f67f59c462ad4171ea4 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 20 Nov 2023 19:19:50 +0100 Subject: 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. --- hurd/hurdexec.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'hurd') 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. */ -- cgit 1.4.1