bug-hurd
[Top][All Lists]
Advanced

[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: Tue, 8 May 2001 07:13:11 +0200
User-agent: Mutt/1.3.15i

On Mon, May 07, 2001 at 06:33:52PM -0700, Thomas Bushnell, BSG wrote:
> Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:
> 
> > 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.
> 
> What kind of "overflow" are you worried about?

Overflowing the ip_srights reference count in the port structure.
(see ipc_right_copyout() in mach:/ipc/ipc_right.c:

                        if (urefs+1 == MACH_PORT_UREFS_MAX) {
                                if (overflow) {
                                        /* leave urefs pegged to maximum */

                                        port->ip_srights--;
                                        ip_release(port);
                                        ip_unlock(port);
                                        return KERN_SUCCESS;
                                }

                                ip_unlock(port);
                                return KERN_UREFS_OVERFLOW;
                        }

For the code path I followed, overflow is TRUE.  Is there something we
should know about this overflow feature?

Note that I am not worried that this actually happens with mach_host_self()
in current applications.  This can be said about most potential failures.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

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