hurd: Fix cancellation just before RPC call
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 28 Oct 2018 11:55:24 +0000 (12:55 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 28 Oct 2018 11:55:24 +0000 (12:55 +0100)
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Set
intr_port to 0 when canceled.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Pass intr_port
address.

ChangeLog
hurd/intr-msg.c
sysdeps/mach/hurd/i386/intr-msg.h

index 365ca36..5709c3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,11 +5,11 @@
        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 again.
-       * hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed the
-       _hurd_intr_rpc_msg_about_to point.
+       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.
+       issue, remove cancel flag check.
 
 2018-10-26  Joseph Myers  <joseph@codesourcery.com>
 
index c347d90..7ace0a1 100644 (file)
@@ -116,7 +116,8 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 
   /* Note that the signal trampoline code might modify our OPTION!  */
   err = INTR_MSG_TRAP (msg, option, send_size,
-                      rcv_size, rcv_name, timeout, notify, &ss->cancel);
+                      rcv_size, rcv_name, timeout, notify,
+                      &ss->cancel, &ss->intr_port);
 
   switch (err)
     {
index baa9ba9..7788c3b 100644 (file)
@@ -23,7 +23,7 @@
 
 /* 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) \
+#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_about_to\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"                             \
-       "_hurd_intr_rpc_msg_about_to:   cmpl $0, %4\n"                        \
+       "_hurd_intr_rpc_msg_about_to:   cmpl $0, %5\n"                        \
        "                               jz _hurd_intr_rpc_msg_do\n"           \
-       "                               movl %5, %%eax\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 %3, %%esp\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)                           \
+       : "=a" (err), "+m" (option), "+m" (timeout), "=m" (*intr_port_p)              \
        : "m" ((&msg)[-1]), "m" (*cancel_p), "i" (EINTR)                              \
        : "ecx");                                                             \
   err;                                                                       \