[Top][All Lists]

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

Re: fork: mach_port_mod_refs: EKERN_UREFS_OWERFLOW

From: Roland McGrath
Subject: Re: fork: mach_port_mod_refs: EKERN_UREFS_OWERFLOW
Date: Thu, 8 Sep 2011 09:43:58 -0700 (PDT)

> Here, we've unconditionally used the value of refs, and didn't take into
> account that record_refs ought to have been used instead, and refs could
> be any value (uninitialized) -- or which detail am I missing here?
> Should refs have simply been initialized to zero (as the zero value is
> noneffective, and we'll set the ss->thread, etc. values later on)?  

I concur that this is clearly wrong, and I've checked in the trivial fix.

> Can this possibly have caused the following:

It could have, though it's by no means certain that this was what you saw
happen.  Since an uninitialized local variable was used here in those
cases, we could very well have set the ref count of the task-self and/or
thread-self ports in the child to any value whatsoever.

> One patch for the TLS code is below; Samuel please have a look.  (Thou
> shalt not invoke mach_thread_self needlessly -- or is there a reason?)
> Unfortunately, this is not all.  I'm continuing.

Does __mach_thread_self bump the ref count?  I suppose it probably does,
in which case extra calls can indeed hurt.


reply via email to

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