bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization insi


From: Sergey Bugaev
Subject: Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds
Date: Fri, 14 Apr 2023 11:53:43 +0300

On Fri, Apr 14, 2023 at 11:39 AM Samuel Thibault
<samuel.thibault@gnu.org> wrote:
> Sergey Bugaev, le ven. 14 avril 2023 11:29:37 +0300, a ecrit:
> > But secondly, if we are not destroying the user's reply port, but
> > restoring it, then I don't think the "port = MACH_PORT_NULL, arg =
> > stale name" case can happen? So we don't need to handle it?

And just as I sent this, I discovered that there is in fact a place
where we do destroy the port! Ugh!

It's in _hurdsig_abort_rpcs, if the interrupt_operation call fails.

Let's maybe not do that either? We're already making mach_msg seem to
have returned EINTR, which intr-msg knows how to handle.

Currently it's doing this:

    case EINTR:
      /* Either the process was stopped and continued,
         or the server doesn't support interrupt_operation.  */
      if (ss->intr_port != MACH_PORT_NULL)
        /* If this signal was for us and it should interrupt calls, the
           signal thread will have cleared SS->intr_port.
           Since it's not cleared, the signal was for another thread,
           or SA_RESTART is set.  Restart the interrupted call.  */
        {
          /* Make sure we have a valid reply port.  The one we were using
             may have been destroyed by interruption.  */
          m->header.msgh_local_port = rcv_name = __mig_get_reply_port ();
          m->header.msgh_bits = msgh_bits;
          option = user_option;
          timeout = user_timeout;
          goto message;
        }
      err = EINTR;

      /* The EINTR return indicates cancellation, so clear the flag.  */
      ss->cancel = 0;
      break;

but I'm thinking it instead should be doing this:

    case EINTR:
      /* Either the process was stopped and continued,
         or the server doesn't support interrupt_operation.  */
      if (ss->intr_port != MACH_PORT_NULL)
        /* If this signal was for us and it should interrupt calls, the
           signal thread will have cleared SS->intr_port.
           Since it's not cleared, the signal was for another thread,
           or SA_RESTART is set.  Restart the interrupted call.  */
        {
          /* Our RPC was interrupted, and the server may have kept the reply
             right.  Get a fresh reply port from MIG.  */
          __mig_dealloc_reply_port (rcv_name);
          m->header.msgh_local_port = rcv_name = __mig_get_reply_port ();

          m->header.msgh_bits = msgh_bits;
          option = user_option;
          timeout = user_timeout;
          goto message;
        }
      err = EINTR;

      /* The EINTR return indicates cancellation, so clear the flag.  */
      ss->cancel = 0;
      break;

...coupled with _hurdsig_abort_rpcs not deallocating our port. wdyt?

Sergey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]