Subject: Re: Problem with gcore and permissions
To: D'Arcy J.M. Cain <darcy@NetBSD.org>
From: Allen Briggs <briggs@netbsd.org>
List: tech-kern
Date: 01/18/2005 08:59:59
On Tue, Jan 18, 2005 at 05:15:41AM -0500, D'Arcy J.M. Cain wrote:
> On Mon, 17 Jan 2005 22:36:28 -0500
> Allen Briggs <briggs@netbsd.org> wrote:
> > Attempting to use SysV semaphores, using an algorithm in Stevens'
> > UNPv2 to prevent a race condition, will cause the code to go into an
> > infinite loop without this change.  The algorithm depends on sem_otime
> > being updated with the time of the last semop(), but that doesn't
> > happen in the old code (this has always been broken).
> 
> So it is possible that some earlier change exposed this existing bug and
> this fixed the root problem?  That could explain why it is happening in
> the release but not before or after.

I can't imagine what would have been able to conceal this bug.  Unless
maybe the structure wasn't being zeroed out before.  Basically, the
UNP code uses the assumption that sem_otime is initialized to zero and
then is set to non-zero on the first semop() call.

I think it's kind of unlikely, but if the sem_otime was not zeroed out,
and just had garbage in it, then the code would fail differently.

-allen

-- 
                  Use NetBSD!  http://www.netbsd.org/