[uClibc 0000716]: libc/misc/utmp/utent.c deadlocks when used with libpthread
bugs at busybox.net
bugs at busybox.net
Fri Feb 10 18:49:16 UTC 2006
The following issue has been SUBMITTED.
======================================================================
http://busybox.net/bugs/view.php?id=716
======================================================================
Reported By: rholzmann
Assigned To: uClibc
======================================================================
Project: uClibc
Issue ID: 716
Category: Other
Reproducibility: always
Severity: minor
Priority: normal
Status: assigned
======================================================================
Date Submitted: 02-10-2006 10:49 PST
Last Modified: 02-10-2006 10:49 PST
======================================================================
Summary: libc/misc/utmp/utent.c deadlocks when used with
libpthread
Description:
utent.c has a few problems with mutex locking when used in a binary that
was linked with pthreads. The are a few deadlock conditions where
functions may be called which lock the utmplock but never release it and
where a function that hold the lock calls other functions which try to
relock the same lock. Here is one example in the function __getutent:
static struct utmp *__getutent(int utmp_fd)
{
if (utmp_fd == -1) {
setutent();
}
if (utmp_fd == -1) {
return NULL;
}
LOCK;
if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) !=
sizeof(struct utmp))
{
return NULL;
}
UNLOCK;
return &static_utmp;
}
Notice the error condition does not unlock the semaphore. The problem is
not visible when pthreads isn't used since the lock/unlock functions are
NOOP functions.
I have attached a patch file that tries to correct these problems. I
think the patch fixes all of the possible deadlock conditions. Let me
know what you think.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
02-10-06 10:49 rholzmann New Issue
02-10-06 10:49 rholzmann Status new => assigned
02-10-06 10:49 rholzmann Assigned To => uClibc
02-10-06 10:49 rholzmann File Added: utmp-thread.patch
======================================================================
More information about the uClibc-cvs
mailing list