aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2021-03-23 22:38:54 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-03-23 22:40:10 +0000
commitc3b287be74e12bdb15ed36e98d24fd42f8ee9122 (patch)
tree82a9f85685a35bf5b12e480ee6ed1abc24103dc8 /hurd/hurdexec.c
parenttst: Add test for sigtimedwait (diff)
downloadglibc-c3b287be74e12bdb15ed36e98d24fd42f8ee9122.tar.gz
glibc-c3b287be74e12bdb15ed36e98d24fd42f8ee9122.tar.bz2
glibc-c3b287be74e12bdb15ed36e98d24fd42f8ee9122.zip
hurd: handle EINTR during critical sections
During critical sections, signal handling is deferred and thus RPCs return EINTR, even if SA_RESTART is set. We thus have to restart the whole critical section in that case. This also adds HURD_CRITICAL_UNLOCK in the cases where one wants to break the section in the middle.
Diffstat (limited to 'hurd/hurdexec.c')
-rw-r--r--hurd/hurdexec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c
index db8989eef6..7dca090c95 100644
--- a/hurd/hurdexec.c
+++ b/hurd/hurdexec.c
@@ -123,6 +123,7 @@ _hurd_exec_paths (task_t task, file_t file,
ss = _hurd_self_sigstate ();
+retry:
assert (! __spin_lock_locked (&ss->critical_section_lock));
__spin_lock (&ss->critical_section_lock);
@@ -429,6 +430,9 @@ _hurd_exec_paths (task_t task, file_t file,
/* Safe to let signals happen now. */
_hurd_critical_section_unlock (ss);
+ if (err == EINTR)
+ /* Got a signal while inside an RPC of the critical section, retry again */
+ goto retry;
outargs:
free (args);