public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4825] New: buggy unlocking of an unlocked pthread_rwlock_t
@ 2007-07-22 22:40 tim at klingt dot org
  2007-07-22 22:41 ` [Bug libc/4825] " tim at klingt dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tim at klingt dot org @ 2007-07-22 22:40 UTC (permalink / raw)
  To: glibc-bugs

according to it's man page, pthread_rwlock_unlock should return EPERM, if the
current thread doesn't hold the lock.

unfortunately it doesn't return EPERM, but 0 ...

-- 
           Summary: buggy unlocking of an unlocked pthread_rwlock_t
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: tim at klingt dot org
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: i486-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=4825

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4825] buggy unlocking of an unlocked pthread_rwlock_t
  2007-07-22 22:40 [Bug libc/4825] New: buggy unlocking of an unlocked pthread_rwlock_t tim at klingt dot org
@ 2007-07-22 22:41 ` tim at klingt dot org
  2007-07-22 22:55 ` tim at klingt dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tim at klingt dot org @ 2007-07-22 22:41 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From tim at klingt dot org  2007-07-22 22:41 -------
Created an attachment (id=1925)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1925&action=view)
regression test


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4825

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4825] buggy unlocking of an unlocked pthread_rwlock_t
  2007-07-22 22:40 [Bug libc/4825] New: buggy unlocking of an unlocked pthread_rwlock_t tim at klingt dot org
  2007-07-22 22:41 ` [Bug libc/4825] " tim at klingt dot org
@ 2007-07-22 22:55 ` tim at klingt dot org
  2007-07-23  5:48 ` jakub at redhat dot com
  2007-07-23  9:24 ` tim at klingt dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tim at klingt dot org @ 2007-07-22 22:55 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From tim at klingt dot org  2007-07-22 22:55 -------
Created an attachment (id=1926)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1926&action=view)
proposed fix

from my marginal knowledge of the glibc implementation, i've written a tiny
patch, that most likely implements the behavior that i expected ...

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4825

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4825] buggy unlocking of an unlocked pthread_rwlock_t
  2007-07-22 22:40 [Bug libc/4825] New: buggy unlocking of an unlocked pthread_rwlock_t tim at klingt dot org
  2007-07-22 22:41 ` [Bug libc/4825] " tim at klingt dot org
  2007-07-22 22:55 ` tim at klingt dot org
@ 2007-07-23  5:48 ` jakub at redhat dot com
  2007-07-23  9:24 ` tim at klingt dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at redhat dot com @ 2007-07-23  5:48 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-07-23 05:48 -------
http://www.opengroup.org/onlinepubs/009695399/functions/pthread_rwlock_unlock.html
Results are undefined if the read-write lock rwlock is not held by the calling
thread.
Additionally, all documented errors for pthread_rwlock_unlock are "may fail",
not "shall fail".

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=4825

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4825] buggy unlocking of an unlocked pthread_rwlock_t
  2007-07-22 22:40 [Bug libc/4825] New: buggy unlocking of an unlocked pthread_rwlock_t tim at klingt dot org
                   ` (2 preceding siblings ...)
  2007-07-23  5:48 ` jakub at redhat dot com
@ 2007-07-23  9:24 ` tim at klingt dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tim at klingt dot org @ 2007-07-23  9:24 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From tim at klingt dot org  2007-07-23 09:24 -------
well, it's not only the result is undefined, but the mutex goes into a broken state:

pthread_rwlock_init(&rwlock, NULL);
pthread_rwlock_unlock(&rwlock);

pthread_rwlock_wrlock(&rwlock); /* deadlock */
pthread_rwlock_unlock(&rwlock);

pthread_rwlock_destroy(&rwlock);

the first unlock has the same semantics as an inversed rdlock ...


i can live with it, but i would appreciate a better documentation of this
behavior ...

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4825

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-23  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-22 22:40 [Bug libc/4825] New: buggy unlocking of an unlocked pthread_rwlock_t tim at klingt dot org
2007-07-22 22:41 ` [Bug libc/4825] " tim at klingt dot org
2007-07-22 22:55 ` tim at klingt dot org
2007-07-23  5:48 ` jakub at redhat dot com
2007-07-23  9:24 ` tim at klingt dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).