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: Mon, 7 May 2001 08:02:48 +0200
User-agent: Mutt/1.3.15i

On Sun, May 06, 2001 at 10:04:12PM -0400, Roland McGrath wrote:
> > 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?
[...]
> Yes, that's appropriate.  It's probably just been omitted out of habit
> because of the similarity to mach_task_self, which is a macro that doesn't
> in fact add another uref.

Yup.  I will work out a patch.

While I am looking at stupid little omissions that don't make a real
difference: In proc/host.c we call host_kernel_version and use the result
without making sure it is actually null terminated. The kernel uses strncpy
to copy out the string.  Should the kernel put

out_version[MAX_KERNEL_VERSION - 1] = '\0';

or should proc do this, or should proc allocated MAX_KERNEL_VERSION + 1 and
set kv[KERNEL_VERSION_MAX] to '\0', to save the last character?

I mainly want to know what the correct approach to fix this is.  We don't
have such long version numbers, but sometimes there is a similar situation
to this.

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]