ports/71005: bug in libsem

Sergey Matveychuk sem at FreeBSD.org
Fri Aug 27 07:30:33 PDT 2004

The following reply was made to PR kern/71005; it has been noted by GNATS.

From: Sergey Matveychuk <sem at FreeBSD.org>
To: freebsd-gnats-submit at FreeBSD.org
Subject: Re: ports/71005: bug in libsem
Date: Fri, 27 Aug 2004 18:21:53 +0400

 Forwarded message from wevake at yahoo.com:
 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 
 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...
 sema_destroy(struct sema *sema)
   chk for sema waiter();
 After change, it will look like...
 sema_destroy(struct sema *sema)
   chk for sema waiter();
   sema->magic = NEW_MAGIC;
 Please chk it out.
 Vivek Pandey
 Mark Linimon <linimon at 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.

More information about the freebsd-bugs mailing list