From mirko.viviani@rccr.cremona.it  Fri Mar 17 05:19:34 2000
Return-Path: <mirko.viviani@rccr.cremona.it>
Received: from rccr1.rccr.cremona.it (rccr1.rccr.cremona.it [194.20.53.49])
	by hub.freebsd.org (Postfix) with ESMTP id B305437BD86
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Mar 2000 05:19:31 -0800 (PST)
	(envelope-from mirko.viviani@rccr.cremona.it)
Received: from mailman.endymion.com (rccr1.rccr.cremona.it [194.20.53.49] (may be forged))
	by rccr1.rccr.cremona.it (8.9.3/8.9.3) with SMTP id OAA05556
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Mar 2000 14:16:16 +0100
Message-Id: <200003171316.OAA05556@rccr1.rccr.cremona.it>
Date: Fri, 17 Mar 2000 14:16:17 +0000
From: mirko.viviani@rccr.cremona.it
To: FreeBSD-gnats-submit@freebsd.org
Subject: libobjc locks mutex before deallocating it

>Number:         17433
>Category:       gnu
>Synopsis:       libobjc locks mutex before deallocating it
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 17 05:20:00 PST 2000
>Closed-Date:    Fri Jan 18 08:14:39 PST 2002
>Last-Modified:  Fri Jan 18 08:15:15 PST 2002
>Originator:     Mirko Viviani
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
>Environment:



>Description:

In the 4.0-RELEASE (and lower) libobjc there is a but in the posix thread
implementation. It locks the mutex before deallocating it.

Anyway in 4.0 is libobjc compiled with thr-posix.c ? I haven't tested 4.0 yet,
but I hope yes.


>How-To-Repeat:

Run any of the GNUstep application that uses threads linked with libobjc
compiled with thr-posix support.


>Fix:

src/contrib/gcc/objc/thr.c - objc_mutex_deallocate() should be changed to:

int
objc_mutex_deallocate(objc_mutex_t mutex)
{
  int depth;

  /* Valid mutex? */
  if (!mutex)
    return -1;

#if 0
  /* Acquire lock on mutex */
  depth = objc_mutex_lock(mutex);
#endif
  depth = 1;

  /* Call backend to destroy mutex */
  if (__objc_mutex_deallocate(mutex))
    return -1;

  /* Free the mutex structure */
  objc_free(mutex);

  /* Return last depth */
  return depth;
}




>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: mike 
State-Changed-When: Sat Jul 21 17:41:47 PDT 2001 
State-Changed-Why:  

Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=17433 
State-Changed-From-To: feedback->closed 
State-Changed-By: sheldonh 
State-Changed-When: Fri Jan 18 08:14:39 PST 2002 
State-Changed-Why:  
Automatic feedback timeout.  If additional feedback that warrants 
the re-opening of this PR is available but not included in the 
audit trail, please include the feedback in a reply to this message 
(preserving the Subject line) and ask that the PR be re-opened. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17433 
>Unformatted:
