aboutsummaryrefslogtreecommitdiff
path: root/hurd/seteuids.c
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/seteuids.c
parenta4ea18ec6cc3f1370efab09bc18c1badbf74aa13 (diff)
downloadglibc-c3b287be74e12bdb15ed36e98d24fd42f8ee9122.zip
glibc-c3b287be74e12bdb15ed36e98d24fd42f8ee9122.tar.gz
glibc-c3b287be74e12bdb15ed36e98d24fd42f8ee9122.tar.bz2
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/seteuids.c')
-rw-r--r--hurd/seteuids.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hurd/seteuids.c b/hurd/seteuids.c
index 19db47f..df0922f 100644
--- a/hurd/seteuids.c
+++ b/hurd/seteuids.c
@@ -31,6 +31,7 @@ seteuids (int n, const uid_t *uids)
for (i = 0; i < n; ++i)
new[i] = uids[i];
+retry:
HURD_CRITICAL_BEGIN;
__mutex_lock (&_hurd_id.lock);
err = _hurd_check_ids ();
@@ -47,6 +48,9 @@ seteuids (int n, const uid_t *uids)
}
__mutex_unlock (&_hurd_id.lock);
HURD_CRITICAL_END;
+ if (err == EINTR)
+ /* Got a signal while inside an RPC of the critical section, retry again */
+ goto retry;
if (err)
return __hurd_fail (err);