[hurd, commited] hurd: _hurd_intr_rpc_mach_msg() might not preserve the correct reply port

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
From: Mike Kelly <[email protected]>

Calls to mach_msg_trap() that return MACH_SEND_INTERRUPTED modify the message header. A subsequent attempt at sending the message can return EINTR for handling by the caller. Mig generated code (expecting the message header to be unaltered) now fails assertion in __mig_dealloc_reply_port(). Fixed by restoring the altered message header content before reattempting RPC message delivery.
Message-ID: <[email protected]>
---
 hurd/intr-msg.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 02e514400f..83db9413ab 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -136,6 +136,13 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 	}
       if (!(option & MACH_SEND_INTERRUPT))
 	{
+	  m->header.msgh_local_port = rcv_name;
+	  m->header.msgh_remote_port = remote_port;
+	  m->header.msgh_id = msgid;
+	  m->header.msgh_bits = msgh_bits;
+	  /* Restore the two words clobbered by the reply data.  */
+	  m->request.data = save_data;
+
 	  option = user_option;
 	  timeout = user_timeout;
 	  goto message;
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.