This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.28.9000-228-g5c81be5


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  5c81be53407434ce22b849722a3d691295480016 (commit)
       via  2d0d1d38761cd9aeb7063c5cce1993cec909f67f (commit)
       via  46a7f24c84299bb1ad63de725f67d1df5dffc2dc (commit)
      from  e5b8756dc2355c315247b710da8d50d48b7a9728 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5c81be53407434ce22b849722a3d691295480016

commit 5c81be53407434ce22b849722a3d691295480016
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue Oct 9 23:40:09 2018 +0200

    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.

diff --git a/ChangeLog b/ChangeLog
index 7d23aa7..5709c3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
 	* hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000.
 	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not
 	answer to interrupt_operation, return EIO instead of EINTR.
+	* 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.
 
 2018-10-26  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 48179b4..d105615 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -292,6 +292,7 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
 		     struct machine_thread_all_state *state, int *state_change,
 		     void (*reply) (void))
 {
+  extern const void _hurd_intr_rpc_msg_about_to;
   extern const void _hurd_intr_rpc_msg_in_trap;
   mach_port_t rcv_port = MACH_PORT_NULL;
   mach_port_t intr_port;
@@ -307,7 +308,8 @@ _hurdsig_abort_rpcs (struct hurd_sigstate *ss, int signo, int sigthread,
      receive completes immediately or aborts.  */
   abort_thread (ss, state, reply);
 
-  if (state->basic.PC < (natural_t) &_hurd_intr_rpc_msg_in_trap)
+  if (state->basic.PC >= (natural_t) &_hurd_intr_rpc_msg_about_to &&
+      state->basic.PC <  (natural_t) &_hurd_intr_rpc_msg_in_trap)
     {
       /* The thread is about to do the RPC, but hasn't yet entered
 	 mach_msg.  Mutate the thread's state so it knows not to try
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 1f7724e..7ace0a1 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)
     {
diff --git a/sysdeps/mach/hurd/i386/intr-msg.h b/sysdeps/mach/hurd/i386/intr-msg.h
index 64f05f8..7788c3b 100644
--- a/sysdeps/mach/hurd/i386/intr-msg.h
+++ b/sysdeps/mach/hurd/i386/intr-msg.h
@@ -20,21 +20,30 @@
 /* Note that we must mark OPTION and TIMEOUT as outputs of this operation,
    to indicate that the signal thread might mutate them as part
    of sending us to a signal handler.  */
-#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
+
+/* After _hurd_intr_rpc_msg_about_to we need to make a last check of cancel, in
+   case we got interrupted right before _hurd_intr_rpc_msg_about_to.  */
+#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify, cancel_p, intr_port_p) \
 ({									      \
   error_t err;								      \
-  asm (".globl _hurd_intr_rpc_msg_do_trap\n" 				      \
-       ".globl _hurd_intr_rpc_msg_in_trap\n"				      \
+  asm (".globl _hurd_intr_rpc_msg_about_to\n"				      \
        ".globl _hurd_intr_rpc_msg_cx_sp\n"				      \
+       ".globl _hurd_intr_rpc_msg_do_trap\n" 				      \
+       ".globl _hurd_intr_rpc_msg_in_trap\n"				      \
        ".globl _hurd_intr_rpc_msg_sp_restored\n"			      \
-       "				movl %%esp, %%ecx\n"		      \
-       "				leal %3, %%esp\n"		      \
+       "_hurd_intr_rpc_msg_about_to:	cmpl $0, %5\n"			      \
+       "				jz _hurd_intr_rpc_msg_do\n"	      \
+       "				movl $0, %3\n"			      \
+       "				movl %6, %%eax\n"		      \
+       "				jmp _hurd_intr_rpc_msg_sp_restored\n" \
+       "_hurd_intr_rpc_msg_do:		movl %%esp, %%ecx\n"		      \
+       "				leal %4, %%esp\n"		      \
        "_hurd_intr_rpc_msg_cx_sp:	movl $-25, %%eax\n"		      \
        "_hurd_intr_rpc_msg_do_trap:	lcall $7, $0 # status in %0\n"	      \
        "_hurd_intr_rpc_msg_in_trap:	movl %%ecx, %%esp\n"		      \
        "_hurd_intr_rpc_msg_sp_restored:"				      \
-       : "=a" (err), "+m" (option), "+m" (timeout)			      \
-       : "m" ((&msg)[-1])						      \
+       : "=a" (err), "+m" (option), "+m" (timeout), "=m" (*intr_port_p)	      \
+       : "m" ((&msg)[-1]), "m" (*cancel_p), "i" (EINTR)			      \
        : "ecx");							      \
   err;									      \
 })

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2d0d1d38761cd9aeb7063c5cce1993cec909f67f

commit 2d0d1d38761cd9aeb7063c5cce1993cec909f67f
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue Oct 9 22:25:19 2018 +0200

    hurd: Return EIO on non-responding interrupted servers
    
    since we do not actually know whether the RPC was completed or not,
    which makes a huge difference for e.g. write(), so better really error
    out than letting caller think that the RPC did not happen.
    
    	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not
    	answer to interrupt_operation, return EIO instead of EINTR.

diff --git a/ChangeLog b/ChangeLog
index 79255d3..7d23aa7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2018-10-28  Samuel Thibault  <samuel.thibault@ens-lyon.org>
 
 	* hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000.
+	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not
+	answer to interrupt_operation, return EIO instead of EINTR.
 
 2018-10-26  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 2f83ac6..1f7724e 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -141,7 +141,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
       else
 	/* The operation was supposedly interrupted, but still has
 	   not returned.  Declare it interrupted.  */
-	goto interrupted;
+	goto dead;
 
     case MACH_SEND_INTERRUPTED: /* RPC didn't get out.  */
       if (!(option & MACH_SEND_MSG))
@@ -324,17 +324,21 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 	  timeout = user_timeout;
 	  goto message;
 	}
-      /* FALLTHROUGH */
+      err = EINTR;
+
+      /* The EINTR return indicates cancellation, so clear the flag.  */
+      ss->cancel = 0;
+      break;
 
     case MACH_RCV_PORT_DIED:
       /* Server didn't respond to interrupt_operation,
 	 so the signal thread destroyed the reply port.  */
       /* FALLTHROUGH */
 
-    interrupted:
-      err = EINTR;
+    dead:
+      err = EIO;
 
-      /* The EINTR return indicates cancellation, so clear the flag.  */
+      /* The EIO return indicates cancellation, so clear the flag.  */
       ss->cancel = 0;
       break;
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=46a7f24c84299bb1ad63de725f67d1df5dffc2dc

commit 46a7f24c84299bb1ad63de725f67d1df5dffc2dc
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue Oct 9 22:27:59 2018 +0200

    hurd: set interrupt timeout to 1 minute
    
    Seeing a server not able to get interrupted for 3s is not so surprising when
    e.g. a lot of writes are happening. 1 minute allows to actually notice the
    issue and be able to debug it.
    
    	* hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000.

diff --git a/ChangeLog b/ChangeLog
index 736d85f..79255d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-28  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000.
+
 2018-10-26  Joseph Myers  <joseph@codesourcery.com>
 
 	* scripts/build-many-glibcs.py: Remove compatibility for missing
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index aa82f63..48179b4 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -57,7 +57,7 @@ unsigned long int __hurd_sigthread_stack_end;
 struct hurd_sigstate *_hurd_sigstates;
 
 /* Timeout for RPC's after interrupt_operation. */
-mach_msg_timeout_t _hurd_interrupted_rpc_timeout = 3000;
+mach_msg_timeout_t _hurd_interrupted_rpc_timeout = 60000;
 
 static void
 default_sigaction (struct sigaction actions[NSIG])

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                         |   13 +++++++++++++
 hurd/hurdsig.c                    |    6 ++++--
 hurd/intr-msg.c                   |   31 +++++++++++--------------------
 sysdeps/mach/hurd/i386/intr-msg.h |   23 ++++++++++++++++-------
 4 files changed, 44 insertions(+), 29 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]