From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 27 14:30:33 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8C8816A4CE for ; Fri, 27 Aug 2004 14:30:33 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9170343D60 for ; Fri, 27 Aug 2004 14:30:33 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i7REUXZS070786 for ; Fri, 27 Aug 2004 14:30:33 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i7REUXnL070785; Fri, 27 Aug 2004 14:30:33 GMT (envelope-from gnats) Date: Fri, 27 Aug 2004 14:30:33 GMT Message-Id: <200408271430.i7REUXnL070785@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Sergey Matveychuk Subject: Re: ports/71005: bug in libsem X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Sergey Matveychuk List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2004 14:30:33 -0000 The following reply was made to PR kern/71005; it has been noted by GNATS. From: Sergey Matveychuk To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: ports/71005: bug in libsem Date: Fri, 27 Aug 2004 18:21:53 +0400 Forwarded message from wevake@yahoo.com: 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 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 -- Sem.