public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/5458] New: PI Mutex Fix breaks multiple program condition variables
@ 2007-12-07 22:16 john dot klug at unisys dot com
  2007-12-07 22:26 ` [Bug libc/5458] " jakub at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: john dot klug at unisys dot com @ 2007-12-07 22:16 UTC (permalink / raw)
  To: glibc-bugs

A change was introduced to NPTL on 2006-07-29 04:31:49 by
drepper@sourceware.org.  This is in 2.5.

Prior to this change it was possible to use pthread_cond_broadcast() to wake up
a program thread asleep on pthread_cond_wait() using shared memory.

This change is documented in 
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S.diff?cvsroot=glibc&r1=1.9&r2=1.10
&
http://sourceware.org/ml/glibc-cvs/2006-q3/msg00061.html

RCS file:
/cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10

The following instruction dereferences the pointer to the mutex that was
provided by the user in pthread_cond_wait(&cond, &mutex).  This causes a memory
fault if pthread_cond_broadcast(&cond) is not called from the same program as
pthread_cond_signal(), since the address is used out of context.

/cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S

+	testl	$PI_BIT, MUTEX_KIND(%r8)

-- 
           Summary: PI Mutex Fix breaks multiple program condition variables
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: john dot klug at unisys dot com
                CC: glibc-bugs at sources dot redhat dot com


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

------- 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] 2+ messages in thread

* [Bug libc/5458] PI Mutex Fix breaks multiple program condition variables
  2007-12-07 22:16 [Bug libc/5458] New: PI Mutex Fix breaks multiple program condition variables john dot klug at unisys dot com
@ 2007-12-07 22:26 ` jakub at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at redhat dot com @ 2007-12-07 22:26 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-12-07 22:26 -------
If this fails, then you just have a buggy program.
Because this is only tested after testing for pshared condvars:
      /* Do not use requeue for pshared condvars.  */
      if (cond->__data.__mutex == (void *) ~0l)
        goto wake_all;
is in C code, the assembly is equivalent (see comparison to -1 and jump).
You must not use a process private condvar between multiple processes,
you need
pthread_condattr_init/pthread_condattr_setpshared/pthread_condattr_destroy to
make the condvar created as process shared.

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


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

------- 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] 2+ messages in thread

end of thread, other threads:[~2007-12-07 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-07 22:16 [Bug libc/5458] New: PI Mutex Fix breaks multiple program condition variables john dot klug at unisys dot com
2007-12-07 22:26 ` [Bug libc/5458] " jakub at redhat dot com

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).