public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/2644] New: Race condition during unwind code after thread cancellation
@ 2006-05-07 13:56 batneil at thebatcave dot org dot uk
  2006-05-07 14:02 ` [Bug nptl/2644] " batneil at thebatcave dot org dot uk
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: batneil at thebatcave dot org dot uk @ 2006-05-07 13:56 UTC (permalink / raw)
  To: glibc-bugs

I think there is a race condition in the code in
nptl/sysdeps/pthread/unwind-forcedunwind.c which can lead to a segfault.  I
found this in a redhat build, but it exists in CVS glibc too (as of May 6 2006).

Consider a call to _Unwind_ForcedUnwind, when libgcc_s_forcedunwind has not been
loaded.  _Unwind_ForcedUnwind checks the value against null, and jumps to
pthread_cancel_init.  Meanwhile another thread comes in and initialises all
these pointers, so the first check in pthread_cancel_init shows that
libgcc_s_getcfa is non-null, so we return to _Unwind_ForcedUnwind and execute
libgcc_s_forcedunwind.  As the function pointer libgcc_s_forcedunwind has not
been marked volatile, the compiler does not need to reload this value, and
attempts to call the address it previously loaded, ie. 0.

I have a test case which shows the problem and patch which I believe fixes it.

-- 
           Summary: Race condition during unwind code after thread
                    cancellation
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: batneil at thebatcave dot org dot uk
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-redhat-linux
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


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

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

end of thread, other threads:[~2014-05-28 19:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-2644-131@http.sourceware.org/bugzilla/>
2011-07-22 22:53 ` [Bug nptl/2644] Race condition during unwind code after thread cancellation prince.cse99 at gmail dot com
2011-07-23  3:50 ` drepper.fsp at gmail dot com
2014-02-16 16:56 ` jackie.rosen at hushmail dot com
2014-05-28 19:41 ` schwab at sourceware dot org
2006-05-07 13:56 [Bug nptl/2644] New: " batneil at thebatcave dot org dot uk
2006-05-07 14:02 ` [Bug nptl/2644] " batneil at thebatcave dot org dot uk
2006-05-07 14:05 ` batneil at thebatcave dot org dot uk
2006-05-07 14:14 ` batneil at thebatcave dot org dot uk
2006-05-07 17:33 ` drepper at redhat dot com
2006-05-07 18:37 ` batneil at thebatcave dot org dot uk
2006-05-07 22:15 ` batneil at thebatcave dot org dot uk
2006-05-07 22:19 ` batneil at thebatcave dot org dot uk
2006-05-08  1:00 ` drepper at redhat dot com
2006-05-08  9:36 ` batneil at thebatcave dot org dot uk
2006-05-08 11:28 ` jakub at redhat dot com
2006-11-28 10:31 ` 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).