[Top][All Lists]

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

Re: mach_host_self() doesn't acquire new port name?!

From: Marcus Brinkmann
Subject: Re: mach_host_self() doesn't acquire new port name?!
Date: Mon, 7 May 2001 04:00:26 +0200
User-agent: Mutt/1.3.15i

On Sun, May 06, 2001 at 08:33:56PM -0400, Roland McGrath wrote:
> > So is it true that port 23 (in my case above) is the host name port for all
> > tasks of the system? It must be, as realport.host_self is a global, and it
> > is passwd through as the mach port (although it is an ipc_port_t).
> You have misunderstood the flow of control.

Yes, I missed the following line in ipc_object_copyout:

                if ((msgt_name != MACH_MSG_TYPE_PORT_SEND_ONCE) &&
                    ipc_right_reverse(space, object, &name, &entry)) {
                        /* object is locked and active */

                        assert(entry->ie_bits & MACH_PORT_TYPE_SEND_RECEIVE);

Notably, I misparsed the "!=" as "==", consequently (but wrongly) skipping
it as I was studying a _SEND case. This is exactly the reverse lookup which
is taking care of finding the port name in the task referring to the port
in question, and increasing the uref in this entry.

Slowly I get better at this, thanks for the patience.

Now, we actually leak all these urefs (for example, when calling
gettimeofday). Even for a process calling mach_host_self() 1000 times a
second it would take 50 days to overflow. For purity, should we deallocate
the port? Overflow is set to TRUE in this code path, so it might
be okay to just not bother anyway (ignoring that we might not want to bother
because it is extremely unlikely to ever overflow)? Am I just paranoid?
There are only a dozen places or so where we call mach_host_self, so it
wouldn't be too hard to fix if that's the right thing to do.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

reply via email to

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