about summary refs log tree commit diff
path: root/hurd/intr-msg.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-10-09 23:40:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-10-28 13:41:51 +0100
commit5c81be53407434ce22b849722a3d691295480016 (patch)
tree930f36f9263b5d02c176d6b13b0ed5a762c8fd83 /hurd/intr-msg.c
parent2d0d1d38761cd9aeb7063c5cce1993cec909f67f (diff)
downloadglibc-5c81be53407434ce22b849722a3d691295480016.tar.gz
glibc-5c81be53407434ce22b849722a3d691295480016.tar.xz
glibc-5c81be53407434ce22b849722a3d691295480016.zip
hurd: Fix race between calling RPC and handling a signal
	* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make
	_hurd_intr_rpc_msg_about_to global point to start of controlled
	assembly snippet. Make it check canceled flag.
	* hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed
	the _hurd_intr_rpc_msg_about_to point.
	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Remove comment on mutation
	issue, remove cancel flag check.
Diffstat (limited to 'hurd/intr-msg.c')
-rw-r--r--hurd/intr-msg.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 1f7724ee8b..7ace0a16b3 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -114,23 +114,10 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 
  message:
 
-  /* XXX
-     At all points here (once SS->intr_port is set), the signal thread
-     thinks we are "about to enter the syscall", and might mutate our
-     return-value register.  This is bogus.
-   */
-
-  if (ss->cancel)
-    {
-      /* We have been cancelled.  Don't do an RPC at all.  */
-      ss->intr_port = MACH_PORT_NULL;
-      ss->cancel = 0;
-      return EINTR;
-    }
-
   /* Note that the signal trampoline code might modify our OPTION!  */
   err = INTR_MSG_TRAP (msg, option, send_size,
-		       rcv_size, rcv_name, timeout, notify);
+		       rcv_size, rcv_name, timeout, notify,
+		       &ss->cancel, &ss->intr_port);
 
   switch (err)
     {