Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Aug 2004 06:17:31 -0700 (PDT)
From:      Vivek Pandey <wevake@yahoo.com>
To:        Mark Linimon <linimon@lonesome.com>, sem@FreeBSD.org
Cc:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/71005: bug in libsem
Message-ID:  <20040827131731.83525.qmail@web52307.mail.yahoo.com>
In-Reply-To: <Pine.LNX.4.44.0408261640070.29335-100000@pancho>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
I am not a user of FreeBSD. I downloaded the FreeBSD semaphore implementation separately. It seems that it's not part of FreeBSD source code. I checked out FreeBSD semaphore implementation as well. It too has same bug. It is in file src/sys/kern/kern_sema.c. - Rev.1.5. I reffered it from the FreeBSD online src browser at http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/kern_sema.c?only_with_tag=MAIN.

In function sem_destroy, just before the mutex is destroyed, if someone else takes the mutex, it will be problem as the mutex will be destroyed by this thread/process while someone is using it. This needs a fix.

One suggestion is to have some magic no. to check the sanity of the sema. Every call to a semaphore will first chk for sanity. The sem_destroy function currently looks like this...

void
sema_destroy(struct sema *sema)
{
 chk for sema waiter();
 destroy_mutex();
 destroty_cv();
}


After change, it will look like...

void
sema_destroy(struct sema *sema)
{
 chk for sema waiter();
 mutex_lock();
 sema->magic = NEW_MAGIC;
 destroy_cv();
 destroy_mutex();
}

 

Please chk it out.

 

Thanx,

Vivek Pandey

 

 


Mark Linimon <linimon@lonesome.com> wrote:
> I downloaded this libsem (POSIX semaphore implementation for FreeBSD) 

Perhaps if you can tell me where you downloaded it from, I can
understand how to classify your bug report.

Also, when following up to a bug report, it is necessary to reply
to the 'freebsd-gnats-submit' address (it should have been included
in a Reply-To line?) and to make sure that the identifying string
is included in the Subject line (in this case, 'ports/71005'). Without
this, your patch simply goes to the mailing list, where it will most
likely be lost in the noise; otherwise, it is correctly filed as
a followup in GNATS.

mcl



		
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040827131731.83525.qmail>